Log In

Maybe it's just because it's late and I'm a bit fried...but hoping another set of "eyes" can help me think about map numbers.

I'm making another shmup. I have a map that is full-width and full-height (16,64) serving as the background. I have the map moving down with viewport being the bottom 16x16 of the map. So the initial map placement on screen is 0,-384

 map(0,0, 0,-384, 32,128)

I have a bunch of flagged sprites in the map that can be hit by bullets. I know how to use fget+mget to check the sprite flag.

The issue I'm having is how to get the x/y of the map tile while it's moving.

I know I need to use the bullet's x/y but I don't know how to match that up to the tile on the map that is scrolling by. I'm guessing it's some sort of offset(?) but I don't know what that would be or how to calculate it into a map tile position.

I'm moving the map down by .25 each tick. It's something that I need to track when a map row goes off the bottom of the screen or something...I dunno...my brain hurts. If you think of something, please share...maybe this will make more sense by lunchtime tomorrow :)

 mapy=-384 function _draw() cls() map(0,0, 0,mapy, 32,128) mapy+=.25 end
P#38796 2017-03-27 23:36 ( Edited 2017-03-29 01:17)

Mget(bullet.x,bullet.y-mapy) should do it I think.

P#38805 2017-03-28 01:12 ( Edited 2017-03-28 05:12)

Thanks for the replies here and on Twitter. I think I got something figured out. Just sketched it out at work so will try tonight at home and see what happens.

My solution feels very "duh hickey" to me so my problem was probably the result of trying to do simple math late at night after dealing with a uncooperative preschooler - a deadly combination.

P#38819 2017-03-28 16:21 ( Edited 2017-03-28 20:21)

Not sure why this was so difficult the other night. Just took some time at work and got it figured out. Tile checking works great with the offsets. I have 3 full-height maps stacked and moving in sync.

I'm hoping a biproduct of this game is a boilerplate of some sort that I will annotate and share.

P#38826 2017-03-28 21:17 ( Edited 2017-03-29 01:17)

[Please log in to post a comment]

Follow Lexaloffle:
Generated 2022-08-12 06:55:05 | 0.004s | Q:9