Spike collision

Codeclass2

  • Posts: 42
Hello, i am once again here with a simple problem. I'm making a sidescroller platformer game. I added some spikes on screen, but every time player falls on them - game shows an error and stars working bad. I didn't add any scripts or events to Spike and i don't know why this problem occurs..

JeffreyDriver

  • Posts: 2262
Please post the error.

Are your spikes actors or tiles?

Codeclass2

  • Posts: 42
Spikes are Actors in my game.

I attached the error. Sorry for the russian language in first line, i'll translate it:
"Cannot call a property or method with link on an object "null""

JeffreyDriver

  • Posts: 2262
A 1009 error means that your code is trying to refer to something that no longer exists. Probably an actor.

Can you post the code that runs when your actor hits the spikes?

Vaibhav Sangwan

  • Posts: 161
Have you set Make camera follow actor or make actor always active.
Also check if you have left any attribute of behaviors attached to both the actor types
Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated

Codeclass2

  • Posts: 42
A 1009 error means that your code is trying to refer to something that no longer exists. Probably an actor.

Can you post the code that runs when your actor hits the spikes?

Sorry, how do i do that? Post the code?

JeffreyDriver

  • Posts: 2262
While you're looking at the code in the events panel, click the camera icon on the bottom right of the screen.

Codeclass2

  • Posts: 42
But that's a thing - i don't have any code not on Player, nor on spikes..

JeffreyDriver

  • Posts: 2262
What does have code attached? What about behaviours?

« Last Edit: February 20, 2018, 02:34:04 am by JeffreyDriver »

Vaibhav Sangwan

  • Posts: 161
If you have no code then how the actors are moving.
You must have some code attached to them so as to move them.
Which behaviors are attached to your hero and spikes?
Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated

Codeclass2

  • Posts: 42
Ah yes, behaviours. Well, i downloaded character Any from StencylForge. I added behavour "Always Simulate" just how Vaibhav Sangwan suggested. Then i deleted health and fire behaviours, because i don't need them in my game.
Actor spike has no behaviours at all.

JeffreyDriver

  • Posts: 2262
I'm still a bit confused that it occurs when the player hits the spikes if there's no code that's being run when the collision happens. Is there no code or behaviours in your scene?

By the way, you don't need the always simulate behaviour of your actor doesn't leave the screen. By default, actors stop updating if off screen, that block just keeps them active.

Vaibhav Sangwan

  • Posts: 161
In your behaviors,is there any place when you kill Any.
If there is,then this is the problem.
When you kill your player, your game still looks for your actor to move camera center to.
If you have to kill him at any place,
You can just set his opacity to 0 and disable all behaviors for him.

Currently working on:-
http://www.stencyl.com/game/play/42376
Feedback will be really appreciated

Codeclass2

  • Posts: 42
I just tried another actor and there was no problem with spike collision. I guess it's some problem with Any's behaviours then..

Stencyl Monkey works just fine.

But Ramona Flowers has the same problems as Any. I just don't get it at all..

Ok, thank you guys, consider this problem solved. There was some problem with actor, i still don't understand which one, but whatever..

« Last Edit: February 20, 2018, 10:39:49 am by Codeclass2 »

JeffreyDriver

  • Posts: 2262
What do Any and Ramona Flowers have in common? And what's different about Stencyl Monkey?

That should help you narrow down the problem.

Also try disabling events one at a time to see if you can figure out the problematic behaviour.