On Collision Issue

81 views
Skip to first unread message

Jay Mattison

unread,
Sep 8, 2017, 4:41:36 PM9/8/17
to CoSpaces Scripting
For a space we are working on, we are attempting to code (with Blockly) an item that resets the player to a spawn point on collision that item with the camera. We have created a new variable and defined it as being the camera object. The item we are attempting to have the collision with was created using the attack ability.


A few hours ago collision was working perfectly on this. However, when we returned to it this afternoon, the collision was now glitching, causing the player to be moved to the spawn point repeatedly. No code changes occurred in the space between theses times. In total, we had 21 items coded to respawn the player on collision with the camera. From testing, it appears that each one of those collision events is being triggered regardless of where the camera is located.

Link to Space: https://cospac.es/PD8O

Pavel Kakolin

unread,
Sep 8, 2017, 5:03:24 PM9/8/17
to cospaces-...@googlegroups.com
Hello Jay. Looks like you are using "on collision" block in a wrong way.

Look at this simple case:


This code means the following: Once Man is collided with any other item on a scene, this item will say that it is collided with Man. That is, when event fires, inside "enter" (and "exit") statement of the block value of variable called "another item" will be equal to an item the Man collided with.

If you want to handle collisions of Man with some specific item, then inside "on collision" block you have to check if value of "another item" variable is equal to the item you are interested in (using "if" block).

Here you can find a video of "on collision" block in action. Hope that helps. 


Pavel Kakolin

unread,
Sep 8, 2017, 5:29:10 PM9/8/17
to CoSpaces Scripting

Here is a proper way to handle collision of camera with "Spikes01"-"Spikes10". If you want to handle collision with other spikes as well, just add them to the list.


Jay Mattison

unread,
Sep 11, 2017, 2:28:14 PM9/11/17
to CoSpaces Scripting
Hello Pavel:

Thanks for the list method. It looks to have solved our issue.
Reply all
Reply to author
Forward
0 new messages