Jump to content

Photo

pause before executing more code


2 replies to this topic

#1 ... OFFLINE  

...

    Combat Commando

  • 1 posts

Posted Sun Jul 22, 2018 9:53 PM

I'm trying to make a "munching squares" effect

 

I need to wait before changing the playfield to the next frame

 

can anyone help me with this?



#2 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 9,222 posts

Posted Mon Jul 23, 2018 12:28 PM

Not sure how to help without seeing the code you're struggling with.  Also, how you pause is a programming choice.  For instance:  I write two separate drawscreen related sections for paused and unpaused gameplay.  The code snippets below are basically two very similar code blocks but one decrements a time display (the paused section doesn't)

 

 rem //** DRAW EVENTS **//

drawevent_main
 COLUPF = pfcolor
 COLUBK = bkcolor
 COLUP0 = p0color
 COLUP0 = counter
 NUSIZ0 = p0size
 NUSIZ1 = p1size
 CTRLPF = pfctrl
 if p0ref then REFP0 = 8
 if p1ref then REFP1 = 8
 player1x = player1x - tempx
 drawscreen
 player1x = player1x + tempx

 rem //** COUNTDOWN TIMER **//

 frames=frames+1:if frames<>one_tenth then skip_tenths
 frames=0
 tenths=tenths&$0F
 minutes=minutes&$F0
 score=score-1
 if tenths=$99 then score=score-90
 if seconds=$99 then score=score-4000
skip_tenths
 tenths=tenths|$A0
 minutes=minutes|$0B
 goto main_begin


drawevent_pause
 COLUPF = pfcolor
 COLUBK = bkcolor
 COLUP0 = p0color
 COLUP0 = counter
 NUSIZ0 = p0size
 NUSIZ1 = p1size
 CTRLPF = pfctrl
 if p0ref then REFP0 = 8
 if p1ref then REFP1 = 8
 player1x = player1x - tempx
 drawscreen
 player1x = player1x + tempx
 goto main_begin

 



#3 Lolkiu64 OFFLINE  

Lolkiu64

    Space Invader

  • 24 posts

Posted Mon Jul 23, 2018 1:37 PM

Are you talking about this: 

Looks awesome, but keep in mind a munching squares program on Atari 2600 won't look as cool because in batari basic the playfield pixels are 32 x 11 (or 32 x 12 if you add some vertical scrolling)

Anyways have a variable play as some sort of timer, each time the current code runs have it take one away from the variable (timer = timer - 1) then once the variable reaches 0 reset the variable to whatever number (ex: 60) and have it move to the next frame.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users