Jump to content
...

pause before executing more code

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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

 

Share this post


Link to post
Share on other sites

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.
  • Like 1

Share this post


Link to post
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.

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