Can someone help me fix the Error ?

yoplalala

  • *
  • Posts: 1632
Okay I think I know ( still try to correct the things in the last post, when I forgot to select the actor in my prject it works only half of the time).

In Stencyl, when there is a collision, there are usually multiple collisions . Why ? Because there's a collision when one pixel point hits another, but there's usually multiple pixel points that hit the collided oject.
So here, the engine will try to kill your actor multiple times, but the second time your actor is already dead. Herein the problem.
So you have to use a boolean

when the actor hits something else.
    if hasBeenHit == False:
             hasBeenHit = True
            kill self


zidaxxx

  • Posts: 131
What do you mean hasBeenHit? what will i put on it?
Is this the correct one i constructed?

« Last Edit: March 13, 2015, 07:04:09 am by zidaxxx »

yoplalala

  • *
  • Posts: 1632
hasBeenHit will be a boolean you will create. You won't have to set any value as default value is False.

zidaxxx

  • Posts: 131
Is this the right one i constructed for Actor Behavior?

yoplalala

  • *
  • Posts: 1632
no change the if hasBeenHit = true to  ( set) hasBeenHit = True
and  Test Tes2t will be correct ( test test isn't)

Have you created the boolean  attribute hasBeenHit ? I'm sorry it just I've never see the design of the block you've used mustn't exist anymore on 3.0

yoplalala

  • *
  • Posts: 1632

Haha at last i found the artcile I wa looking for. It will explain your problem better than me
http://www.thestencylblog.com/2012/06/16/stencyl-events-do-please/

From this page



« Last Edit: November 16, 2020, 11:23:36 pm by Justin »

zidaxxx

  • Posts: 131
Is this correct?

yoplalala

  • *
  • Posts: 1632
You have to create the boolean in the palette before  like you did it in ResetHealth and the others :)

zidaxxx

  • Posts: 131
Hahaha i am so slow learner. sorry for the delay.

Is this correct now?

SadiQ

  • Posts: 1795
Does it still give you the error?
Is that in the bullet behavior?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

zidaxxx

  • Posts: 131
Do I have to make Boolean Initial Value to Yes or No?

And @SadiQ yes its still gives me an Error when i try to attack the incoming Enemy Bullet. and yes i place the Test Collision to Enemy Bullets and still gives me an error.

SadiQ

  • Posts: 1795
The boolean must be set to false, and you should NOT use a game attribute. Make a blue attribute for that. And I also think that you should put that code on the actor(with some modifications). Check for where the actor is checking for collisions and post the code.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

zidaxxx

  • Posts: 131
The Enemy Bullets collides with Main Actor and Sword Weapon or Spear Weapon and when i attack the bullets the sword / spear disapeared and error comes out.

SadiQ

  • Posts: 1795
Look for where the actor is checking for collisions and post the code.
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

zidaxxx

  • Posts: 131
Sorry for this question but how can I do that ?