W
Whittick
Guest
Help - collisions stopped working when I upgraded
I am using Gamemaker Studio (mainly drag and drop) - we recently upgraded to studio - and in the latest update object such as coins no longer have the same collision - the player has to jump on the object to collect it - whereas before the collision worked perfectly Mario style - running into the collectible.
Hero obj is solid
collectible is not
have tried making both or none solid
have altered depth, masks, sprites
have added variable score and added code
score+=1
with other instance_destroy()
In the collision instead of just dragging the instruction in
Bullets (also non-solid) are now appearing to be solid - hero is now impeded by a bullet fired when running - code for hero below
Information about object: ob_hero
Sprite: righthero
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set the score to 0
set the number of lives to 3
set variable sptite_index to righthero
Step Event:
execute code:
if place_free(x,y+1) {gravity=0.5 gravity_direction=270}else{gravity=0}
Collision Event with object ob_wall:
execute code:
if vspeed>0 && !place_free(x,y+vspeed) {move_contact(270)}vspeed=0
Collision Event with object ob_food:
execute code:
score+=1
with other instance_destroy()
if number of objects ob_food is equal to 0
display message: Level up
Go to next room
Keyboard Event for <Left> Key:
if relative position (-3,0) gives not a collision with Only solid objects
jump relative to position (-3,0)
Keyboard Event for <Up> Key:
if relative position (0,+1) gives a collision with Only solid objects
set the vertical speed relative to -9
Keyboard Event for <Right> Key:
if relative position (3,0) gives not a collision with Only solid objects
jump relative to position (3,0)
Key Press Event for <Space> Key:
if sprite_index is equal to righthero
create instance of object obj_bullet at relative position (16,16) with speed 8 in direction 0
if sprite_index is equal to lefthero
create instance of object obj_bullet at relative position (16,16) with speed 8 in direction 180
Key Press Event for <Left> Key:
set the sprite to lefthero with subimage 0 and speed 1
Key Press Event for <Right> Key:
set the sprite to righthero with subimage 0 and speed 1
I am using Gamemaker Studio (mainly drag and drop) - we recently upgraded to studio - and in the latest update object such as coins no longer have the same collision - the player has to jump on the object to collect it - whereas before the collision worked perfectly Mario style - running into the collectible.
Hero obj is solid
collectible is not
have tried making both or none solid
have altered depth, masks, sprites
have added variable score and added code
score+=1
with other instance_destroy()
In the collision instead of just dragging the instruction in
Bullets (also non-solid) are now appearing to be solid - hero is now impeded by a bullet fired when running - code for hero below
Information about object: ob_hero
Sprite: righthero
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set the score to 0
set the number of lives to 3
set variable sptite_index to righthero
Step Event:
execute code:
if place_free(x,y+1) {gravity=0.5 gravity_direction=270}else{gravity=0}
Collision Event with object ob_wall:
execute code:
if vspeed>0 && !place_free(x,y+vspeed) {move_contact(270)}vspeed=0
Collision Event with object ob_food:
execute code:
score+=1
with other instance_destroy()
if number of objects ob_food is equal to 0
display message: Level up
Go to next room
Keyboard Event for <Left> Key:
if relative position (-3,0) gives not a collision with Only solid objects
jump relative to position (-3,0)
Keyboard Event for <Up> Key:
if relative position (0,+1) gives a collision with Only solid objects
set the vertical speed relative to -9
Keyboard Event for <Right> Key:
if relative position (3,0) gives not a collision with Only solid objects
jump relative to position (3,0)
Key Press Event for <Space> Key:
if sprite_index is equal to righthero
create instance of object obj_bullet at relative position (16,16) with speed 8 in direction 0
if sprite_index is equal to lefthero
create instance of object obj_bullet at relative position (16,16) with speed 8 in direction 180
Key Press Event for <Left> Key:
set the sprite to lefthero with subimage 0 and speed 1
Key Press Event for <Right> Key:
set the sprite to righthero with subimage 0 and speed 1