Sorry Latch
lol
I'm not going to be on much until 4th January so I'll wish you all a Merry Christmas and see you in the new year.
I'm setting a deadline on this project for 5th February 2010
That gives us a month to get it finished.
My PC is finally back on the internet (wooooooop!) so I'll be much more productive in the new year.
@Ashingda
I've gone through your code and made a few editions a bit (hope you don't mind). It's pretty good and I like how you've made a structure that allows for further actions to be added.
remstart
Program Name: Mario Animation
Author: Ashingda27
Date: 7th Nov 2009
==============================
Edited: OBese87 - 22/12/09
==============================
remend
hide mouse
sync on
sync rate 30
gosub Initialize
rem === MAIN ===
do
MovePlayer(0)
DrawPlayer(0)
sync:cls
loop
rem === SUBROUTINES ===
Initialize:
`Ashingda - This is used as global for the Function DrawCharacter
dim PointerPlayer(0) : PointerPlayer(0) = 100
`Ashingda - Loading the Character Images.
load bitmap "media/Character.png"
n = 0
for lpy = 0 to 3
for lpx = 0 to 8
x = lpx*16
y = lpy*24
get image PointerPlayer(0)+n,x,y,x+16,y+24,1
inc n
next lpx
next lpy
Max = 0
dim Direction(Max)
dim Frame(Max)
dim Act(Max)
dim Animation(Max)
dim Px#(Max)
dim Py#(Max)
dim MoveX(Max)
dim MoveY(Max)
Py#(0) = 320 :`Set Mario's starting height.
`Ashingda - These are used as constants
dim Stand(0) : Stand(0) = 0
dim Walk(0) : Walk(0) = 1
dim Slide(0) : Slide(0) = 2
dim Jump(0) : Jump(0) = 3
dim Hurt(0) : Hurt(0) = 4
dim Dead(0) : Dead(0) = 5
dim Left(0) : Left(0) = 0
dim Right(0) : Right(0) = 9
dim AnimationPlayer(3,5)
for lp = 0 to 3
AnimationPlayer(lp,Stand(0)) = 0
AnimationPlayer(lp,Walk(0)) = val(mid$("1213",lp+1))
AnimationPlayer(lp,Slide(0)) = val(mid$("4545",lp+1))
AnimationPlayer(lp,Jump(0)) = 6
AnimationPlayer(lp,Hurt(0)) = 7
AnimationPlayer(lp,Dead(0)) = 8
next lp
return
`//
rem === FUNCTIONS ===
Function MovePlayer(p)
Act(p) = 0
speed# = .3
rem obese - Flag Mario's X movement and direction.
Xmove = (rightkey() - leftkey())
if Xmove ! 0 then Animation(p) = Walk(0) : Act(p) = 1 : FinalXmove# = (Xmove+Xmove)*speed#
if Xmove < 0 then Direction(p) = Left(0)
if Xmove > 0 then Direction(p) = Right(0)
MoveX(p) = MoveX(p) + Xmove
rem obese - If not running mario slides to a stop.
if Act(p) = 0
if MoveX(p) ! 0
MoveX(p) = MoveX(p) - FinalXmove#
endif
if MoveX(p) = 0 then Animation(p) = Stand(0) else Animation(p) = Slide(0)
endif
rem obese -
if upkey() and MoveY(p) = 0
MoveY(p) = -5
endif
rem obese - zero gravity jump
if MoveY(p) < 0
MoveY(p) = MoveY(p) + 1
Animation(p) = Jump(0)
endif
rem obese - update player position and frame
Px#(p) = Px#(p) + MoveX(p)*speed#
Py#(p) = Py#(p) + MoveY(p)
if Frame(p) < 3 then Frame(p) = Frame(p) + 1 else Frame(p) = 0
EndFunction
`//
Function DrawPlayer(p)
Image = PointerPlayer(0) + AnimationPlayer(Frame(p),Animation(p)) + Direction(p)
if image exist(Image) then paste image Image,Px#(p),Py#(p),1
EndFunction
`//
I'm wondering whether we should make the sliding to a stop a separate action or just leave it to come on when walking stops.
"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright