Jump to content
IGNORED

Platformer game - way over my head with collisions.


Captain Spazer

Recommended Posts

I seem to be over my head with this one, I'm doing a platformer experiment, the engine works perfectly, but implementing enemies seems to be problematic:

 

 Any ideas on what might be wrong with the code below?

 In general: There are 0-3 states of player0: 0 means no spawn, 1 means an enemy, 2 is also an enemy, 3 is gold coins for you to pickup. Picking up gold coins work, but colliding with player0 when player0 isn't gold coins does not register at all, player0 just passes through player1 without lowering pfscore1 at all.

 rem player picks up gold
 if Monster_Type > 2 && collision(player0,player1) then score = score + 100 : player0x = 255 : player0y = 255 : Monster_Type = 0
 rem take damage if player0 isn't gold
 if Monster_Type < 3 && collision(player0,player1) then pfscore1/4

 

Link to comment
Share on other sites

You're not using "pfscore1 = pfscore1/4".

 

You might also want to do something like this so you're not checking for the collision twice:

 

   if !collision(player0,player1) then goto __Skip_Collision

   if Monster_Type > 2 then score = score + 100 : player0x = 255 : player0y = 255 : Monster_Type = 0

   if Monster_Type < 3 then pfscore1 = pfscore1/4

__Skip_Collision

 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...