I'm more than happy to share my project... this is just a hobby project...
main.agc
//
rem AGK Application
rem AGK Build 107
//
// Project# 003
// version 1.0
// Last Revised 01-16-13
#include subroutines.agc
#include functions.agc
rem Landscape App
SetVirtualResolution (640 , 480 )
rem background
backdrop = CreateSprite ( LoadImage ( "M_background1.png" ) )
rem load music and sounds
LoadMusic ( 1, "Sum 41.mp3" )
SetMusicFileVolume (1, 75 )
LoadSound (1, "groar1.wav" )
rem Set Sprite variables X&Y
X#=23.00
Y#=311.89
rem sprite variable for position_sprite subroutine
// sets sprite to be used by sprite ID
sprA=1
rem used for making sprite jump
dirJ=2 // sprite direction variable "tells direction 1-left or 2-right"
jumS#=23.00 // start X axis of jump
jumE#=23.00 // end x axis of jump
jumB#=311.89 // start y axis of jump
rem Set up the Timing parameters
myTime# = Timer()
startTime# = myTime#
rem create sprite
CreateSprite ( 1, 0 ) // create a sprite with ID that has no image
SetSpriteOffset(1, getspritewidth(1)/2 , getspriteheight(1)/2 ) // sets sprites X&Y to center
SetSpritePosition ( 1, x#, y# )
rem add individual images into an animation list for Sprite 1
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws2b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws3b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws4b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws5b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws6b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws1b.png" ) )
rem play the animated sprite
SetSpriteScale (1, 2, 2) // doubles the sprite size
PlaySprite ( 1, 10, 0, 1, 6 )
rem play and loop the music
PlayMusic ( 1, 1 )
rem Main Program Loop
do
//gosub position_sprite // position_sprite subroutine and show sprites X&Y
rem get inputs
Dirx# = GetJoystickX() // gets X axis input from joystick
Diry# = GetJoystickY() // gets Y axis input from joystick
se1# = GetButtonState(1) // gets button 1 input from jotstick
rem play sound if button A was pressed
if getbuttonstate(1)=1
playsound(1,100,0)
endif
rem walking Right
if Dirx# > 0.5
dirJ=2
setspriteflip(1, 0, 0) // resets sprite flip to start if necessary
if getSpriteCurrentFrame(1) >= 6
PlaySprite ( 1, 10, 0, 1, 6 )
SetSpriteActive(1,1)
endif
x# = x# + 1.0
setspriteposition(1,x#,y#) // update sprite position
endif
rem walking Left
if Dirx# < -0.5
dirJ=1
setspriteflip(1, 1, 0) //flip the sprite to make it seem like its facing the other way
if getSpriteCurrentFrame(1) >= 6
PlaySprite ( 1, 10, 0, 1, 6 )
SetSpriteActive(1,1)
endif
x# = x# - 1.0
setspriteposition(1,x#,y#) // update sprite position
endif
rem JUMP
if Diry# > 0.5
//if dirJ > 1
jumS# = x#
jumE# = x# + 50.0
jumB# = y# - 10.0
gosub sprite_jumpR
endif
//endif
Sync()
loop
setup.agc
rem
rem ----------*** AGK Setup File ***----------
rem
rem NOTE: This file is used by the core binary
rem to configure basic setup values required
rem prior to execution of the AGC source code.
rem No spaces allowed beyond this point:
rem Window title (delete to hide window bar)
title=Godzilla Demo2
rem Specify the initial device width
width=640
rem Specify the initial device height
height=480
// Specify whether to use fullscreen mode
fullscreen=0
subroutines.agc
rem get input and move sprite
Dirx# = GetDirectionX()
Diry# = GetDirectionY()
if Dirx# > 0.5 then x# = x# + 1.0
if Dirx# < -0.5 then x# = x# - 1.0
if Diry# > 0.5 then y# = y# + 1.0
if Diry# < -0.5 then y# = y# - 1.0
setspriteposition(sprA,x#,y#) // update sprite position
rem show Sprite X and Y
print(" X position = " + str ( GetSpriteX(1)))
print(" Y position = " + str ( getspritey(1)))
Sync()
return
sprite_jumpR:
while myTime# < startTime# + 1.5
timeLapse# = (myTime# - startTime#) / 1.5
x# = Berp(jumS#, jumE#, timeLapse#, 3)
y# = Berp(jumB#, 311.89, timeLapse#, 3)
setspriteposition(1,x#,y#)
sync()
endwhile
return
fuctions.agc
//
function Berp( startValue as float, endValue as float , curValue as float, overshoot as float )
curValue = (sin(curValue * 3.14159 * (0.2 + 2.5 * curValue * curValue * curValue)) * (1.0 - curValue ^ 2.2) + curValue) * (1.0 + (overshoot * (1.0 - curValue)))
result# = startValue + (endValue - startValue) * curValue
endfunction result#