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: 1866
Please post the error.

Are your spikes actors or tiles?
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

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: 1866
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?
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Vaibhav Sangwan

  • Posts: 157
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

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: 1866
While you're looking at the code in the events panel, click the camera icon on the bottom right of the screen.
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Codeclass2

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

JeffreyDriver

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

« Last Edit: February 20, 2018, 02:34:04 am by JeffreyDriver »
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Vaibhav Sangwan

  • Posts: 157
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?

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: 1866
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.
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Vaibhav Sangwan

  • Posts: 157
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.


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: 1866
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.
Current Projects:
Horror Point & Click Episode 1.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk