Enjoy my final release revision 2.9!
Changed the map to random generation.
Larger map and performance improvement.
fixed some bugs, grow the title and simplified some functions in the code!
2019-04-26 update: add attract demo mode for arcade vibe!
2019-08-12 updates, back to tiled map with the map wrap!!
special thanks to @dw817 I give him credits for wrap map code help! :)
fixed collision algorithm too.
That's no trick. Let's see, for PICO-8 that would be ...
-- simple wrap-map example -- written by dw817 cls() y=7 for i=0,127 do repeat c=0 ok=0 r=flr(rnd()*3) if (i-113>(7-y) and y<7) r=2 if (i==127 and y==7) r=1 if (r==0 and y>0) or r==1 or (r==2 and y<7) then if (r==0) y-=1 c=1 ok=1 if (r==1) c=2 ok=1 if (r==2) c=3 ok=1 mset(i,y+8,c) if (r==2) y+=1 end until ok==1 end x=0 y=0 repeat cls() camera() print("x="..x.." y="..y) camera(x,y) map() map(0,0,1024) flip() s=1 if (btn(🅾️)) s=8 if (btn(⬅️)) x-=s if (btn(➡️)) x+=s x=x%1024 until forever
Hold down (O) to speed up scrolling.
The tricky code here:
if (i-113>(7-y) and y<7) r=2 if (i==127 and y==7) r=1
is to ensure the wrapping edge also starts at the bottom.
HOPE THIS HELPS !
@dw817 Brilliant! Usefull for the first Gorg's version when i used a tilemaped hills... the last one uses lines draws from a points table.
thanks! I follow ya. :)
This is the version i made with your Wrap map code. Looks like I got a clipping problem when intersect map boundary. Seems like the draw_hud function slow down things.
Yep. A clipping problem. Let me see ...
Think I fixed it.
and that oughta get it.
You might tighten up your collision check. Seems like if you just get in the airspace of an enemy, the player collides anyways. While there is no pixel-per-pixel routine like COLLIDE() for PICO YET, you should be able to give the player a bit more breathing room since their ship is short vertically.
Tried a few other things.
Modified it so if you are traveling left and press right, you stop instantly. Also traveling right, press left, stop instantly.
Changed the speed of the player so starting to accelerate takes twice as long to reach full speed.
if btn(⬅️) then if (player.spd>0) player.spd=0 player.spd-=0.05 player.flp=true elseif btn(➡️) then if (player.spd<0) player.spd=0 player.spd+=0.05 player.flp=false end
Modified the cannon so if held it shoots only sporadically, encouraging the player to time their individual shots.
if btn(🅾️) or btn(❎) then btnr=flr(rnd()*16)+8 if btntime%btnr==0 then lazer_init() btntime+=1 end btntime+=1 else btntime=0 end
Noticed both the stars and mountains appeared in front of the player, changed the order of display so they appear behind the player's ship.
See if this helps player and visual control. :)
I wasn't going to mention that Apple ][ game until I found the one I was searching to compare it with - which I haven't yet. It's really more along the lines of what you have here.
It's Defender, yes, but you shoot targets only, no rescue, yet it looks like Defender. Do you know this game for the Apple ][ ?
Oh, and I don't know if this is any faster. You can get random number using this:
Where the random number you want is 0 to (n-1).
Also there is:
Here is what I have been using, which may not be any faster:
Suggest ZEP give you a forced and seeded # when you use any number greater than zero for rnd() and if you choose rnd(-1) or rnd(), then it goes back to unseeded automatically.
@dw817 yes this game is GORGON from sirius Software on the Aplle II...hmm out in 1981 or 1983. A defender clone with the twist of limited fuel where you have to raise up in space, pass trhu satellites to fill up your fuel with the mothership (USS enterprise) and back to the game on the planet.
[Please log in to post a comment]