Jump to content
IGNORED

Temp5 question


Lillapojkenpåön

Recommended Posts

if !collision(player0,player1) then goto __Skip_p0_Collision
temp5 = _Data_Sprite_Width[_Sprite_Size0]
if (player0y + 10) >= player1y && player0y <= (player1y + 10) && (player0x + temp5) >= player1x && player0x <= (player1x + 7) then pfpixel 9 11 on
if (player0y + 10) >= player2y && player0y <= (player2y + 10) && (player0x + temp5) >= player2x && player0x <= (player2x + 7) then pfpixel 9 20 on

__Skip_p0_Collision

 

Can the data sprite width and sprite size tables be replaced with just some variables/numbers if i don't want to use 3 different nusiz like in rt's example?

 

temp5 = something simple?

Link to comment
Share on other sites

I figured it out myself, this works very well

 

if !collision(player0,player1) then goto __Skip_p0_Collision
temp5 = player1x
if (player0y + 10) >= player1y && player0y <= (player1y + 10) && (player0x + temp5) >= player1x && player0x <= (player1x + 7) then goto player1dead
if (player0y + 10) >= player2y && player0y <= (player2y + 10) && (player0x + temp5) >= player2x && player0x <= (player2x + 7) then goto player2dead

__Skip_p0_Collision

if (missile0y + 10) >= player1y && missile0y <= (player1y + 10) && (missile0x + temp5) >= player1x && missile0x <= (player1x + 7) then goto player1dead
if (missile0y + 10) >= player2y && missile0y <= (player2y + 10) && (missile0x + temp5) >= player2x && missile0x <= (player2x + 7) then goto player2dead

 

I also removed temp5 = player1x completely and it still works perfect, definitely looked like you had to define temp5 there in that example :mad:

Link to comment
Share on other sites

Your collision detection (dpc+) example

 

Thanks. That program is basically just a toy for doing little experiments (playing with sprite sizes, seeing how playfield collision works, and so on). It wasn't designed to be used as a template. I need to make some simpler DPC+ example programs one of these days.

Link to comment
Share on other sites

If you make a simpler collision example sometime, I would suggest including a death animation, you know the classic one where you shoot a sprite and it turns into particles.

I couldn't find a single bB game that had that.

 

I made a working routine but i had to put duplicates of all the other sprites animation (walking) frames inside it, and they usually pick up at the wrong animation frame when one of them dies.

 

Btw

if s=10 then player1-9:
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
%00000000
end

 

If I don't want player3 in there, how would that look if possible?

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...