Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Game Frame Animation using Screen Pages and using TIMER
#1
I was looking in these forums to find out how to do animations in a game and character movement such as the snake used in this program.

What I want to know is if using the keyboard arrowkeys to move the Character(Al) around on the screen) ..... would this have any affect on speed or the animations while using Screen Pages?

I really need to know how to make the whole thing flow.

If you have checked out the game Paganitzu (by Apogee/3drealms), the character (Alabama Smith) can be moved around in the game using the arrow keys. The timing of his movement along with the rest of the things moving on the screen is what I am looking for.

How is this all done at the same time?



The code for Snake animation:

DIM SHARED Snake1(132)
DIM SHARED Snake2(132)
DIM SHARED Snake3(132)
DIM SHARED Snake4(132)
DIM SHARED Wall1.1(132)
DIM SHARED SpiderL1(132)
DIM SHARED SpiderL2(132)
DIM SHARED SpiderR1(132)
DIM SHARED SpiderR2(132)

SCREEN 7, , 1, 0
frame = 0
GOSUB Snake1
GOSUB Snake2
GOSUB Snake3
GOSUB Snake4
GOSUB Wall1.1
GOSUB SpiderL1
GOSUB SpiderL2
GOSUB SpiderR1
GOSUB SpiderR2

PUT (0, 16), SpiderL1, PSET
PUT (16, 0), SpiderL2, PSET
PUT (32, 0), SpiderR1, PSET
PUT (48, 0), SpiderR2, PSET
PUT (0, 0), Wall1.1, PSET
PUT (16, 16), Snake1, PSET
PCOPY 1, 0


CONST Snke1 = .1


S1! = TIMER
SP1! = S1!

frame = 0

DO

SELECT CASE TIMER - S1!

CASE IS > Snke1
S1! = TIMER
GOSUB Frme

END SELECT

PCOPY 1, 0

LOOP

Frme:

frame = frame + 1

SELECT CASE frame

CASE IS = 9
frame = 0

CASE IS = 1
PUT (16, 16), Snake1, PSET

CASE IS = 2
PUT (16, 16), Snake2, PSET

CASE IS = 3
PUT (16, 16), Snake3, PSET

CASE IS = 4
PUT (16, 16), Snake4, PSET

CASE IS = 5
PUT (16, 16), Snake3, PSET

CASE IS = 6
PUT (16, 16), Snake2, PSET
frame = 8
GOTO Frme

END SELECT

RETURN


Snake1:
GOSUB Color.It
GET (0, 0)-(15, 15), Snake1
CLS
RETURN

Snake2:
GOSUB Color.It
GET (0, 0)-(15, 15), Snake2
CLS
RETURN

Snake3:
GOSUB Color.It
GET (0, 0)-(15, 15), Snake3
CLS
RETURN

Snake4:
GOSUB Color.It
GET (0, 0)-(15, 15), Snake4
CLS
RETURN

Wall1.1:
GOSUB Color.It
GET (0, 0)-(15, 15), Wall1.1
CLS
RETURN

SpiderL1:
GOSUB Color.It
GET (0, 0)-(15, 15), SpiderL1
CLS
RETURN

SpiderL2:
GOSUB Color.It
GET (0, 0)-(15, 15), SpiderL2
CLS
RETURN

SpiderR1:
GOSUB Color.It
GET (0, 0)-(15, 15), SpiderR1
CLS
RETURN

SpiderR2:
GOSUB Color.It
GET (0, 0)-(15, 15), SpiderR2
CLS
RETURN


Color.It:
FOR y = 0 TO 15
FOR x = 0 TO 15
READ CLR
PSET (x, y), CLR
NEXT x
NEXT y
RETURN



' Snake1
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,5,0,4,4,12,0,0,0,0,0
DATA 0,0,0,0,0,5,0,0,0,7,4,12,0,0,0,0
DATA 0,0,0,0,0,5,0,0,4,4,12,0,0,0,0,0
DATA 0,0,0,0,0,5,0,4,12,0,0,0,0,0,0,0
DATA 0,0,0,0,0,5,0,4,12,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,5,0,4,12,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,5,0,4,12,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,5,0,4,12,0,0,0,0
DATA 0,0,0,0,0,0,0,0,0,5,0,4,12,0,0,0
DATA 0,0,0,0,0,0,0,0,0,0,5,0,4,12,0,0
DATA 0,0,0,0,0,0,0,0,12,12,0,5,0,4,12,0
DATA 0,0,0,0,0,0,12,12,4,4,12,5,0,4,12,0
DATA 0,0,12,12,12,12,4,4,5,0,0,0,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0,0,0,0,0,0,0,4,0,0,0,0,0,0,0
' SpiderR2
DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0
DATA 0,0,4,4,4,4,4,0,0,4,0,0,4,4,0,0
DATA 0,0,0,0,0,0,0,4,0,4,0,4,0,0,0,0
DATA 0,0,0,0,12,12,12,0,4,4,4,0,4,0,0,0
DATA 0,0,0,4,4,4,4,12,0,12,12,12,0,4,0,0
DATA 0,0,0,4,4,4,4,12,4,4,4,4,12,0,4,0
DATA 0,0,0,4,4,4,4,0,4,4,4,4,4,12,0,0
DATA 0,0,0,4,4,4,4,0,4,4,4,4,0,0,4,0
DATA 0,0,0,4,4,4,4,0,0,0,0,0,0,4,0,0
DATA 0,0,0,0,4,0,0,0,4,4,4,0,4,0,0,0
DATA 0,0,0,0,0,0,0,4,0,4,0,4,0,0,0,0
DATA 0,0,4,4,4,4,4,0,0,4,0,0,4,4,0,0
DATA 0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0
DATA 0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0
I'm your Huckleberry; that's just my game."

Doc Holiday, TOMBSTONE
Reply
#2
For Animations check this:

http://rel.betterwebber.com/junk.php?id=8


For a lil tute on screen 13 pages:

http://faq.qbasicnews.com/?blast=SetVide...enThirteen
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#3
I've looked at that tutorial for screen 13 quite a few times already but that is not what I'm looking to do. I need to use screen 7 and be able to make objects move there using pages I would think. I don't know how to do that though.
I'm your Huckleberry; that's just my game."

Doc Holiday, TOMBSTONE
Reply
#4
One possible way to do this is have three pages, a background, an active page and a visible page. Store your background . Then you have a loop:

Code:
DO                
  PCOPY BackGround,  ActivePage

  IF user input THEN call your input routine

  Place player sprite at player position
  
  FOR CurrentCharacter = 1 TO NumberofNonPlayerCharacters
    ChangePosition CurrentCharacter, CurCharPosition
    PUT CurCharSprite at CurCharPosition on ActivePage
    IF combat condition THEN call your combat routine
  NEXT

  WAIT &H3DA, 8                     'Video synch and speed control
  SWAP ActivePage, VisiblePage
  SCREEN 7,, ActivePage, VisiblePage
LOOP UNTIL exit conditions met
Note: you can do this is screen 13 as well, and you have more colors to work with. The example at the end of http://faq.qbasicnews.com/?blast=DoubleBufferingGeneral shows how to use SetVideoSeg to be able to draw to buffers. You can copy SetVideoSeg from the example, but remember to leave the credit on it for Plasma.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)