Post by Wayne Rayner on Apr 5, 2011 21:29:14 GMT -5
Ok so basically I have this problem. I like to keep my code looking neat and to make a sort of movement the code gets ugly. Also is there any way to make it move in a Frame Rate because otherwise the character walks super fast.
The code that I like, nice neat and it's really not a lot yet
I know you don't need a texture to test it out because I don't have any textures as of yet. BTW this code doesn't work but it is how I like to set it out.
This code works but is less organised
So is there any other better way to keep code organised and have movement?
Also how do you calculate framerate and how do you make objects move at a certain framerate?
regards
Wayne Rayner
The code that I like, nice neat and it's really not a lot yet
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SleeperRPG ' '
' Developed by: Kottonmouth Games '
' Published by: N/A at the current time '
' Lead Programmer: Wayne Rayner '
' Lead Artist: Wayne Rayner '
' Lead Sound Tech: Wayne Rayner '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Versions ' '
dim Ver$ = "0.0.1" '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Setup '
WindowTitle("SleeperRPG " + Ver$) '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Texture Variables
dim tex(10), player, PosX, PosY \
PosX = 320
PosY = 240
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Sound Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' LoadTextures
Tex(0) = LoadTex("Graphics/Player.jpg")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Load Sounds
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Intro
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Main Menu
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Game
player = NewSprite(Tex1)
SprSetPos(PosX,PosY)
SprSetSize(32,32)
BindSprite(player)
While True
if ScanKeyDown(VK_UP) then
PosY = PosY + 5
endif
wend
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I know you don't need a texture to test it out because I don't have any textures as of yet. BTW this code doesn't work but it is how I like to set it out.
This code works but is less organised
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SleeperRPG ' '
' Developed by: Kottonmouth Games '
' Published by: N/A at the current time '
' Lead Programmer: Wayne Rayner '
' Lead Artist: Wayne Rayner '
' Lead Sound Tech: Wayne Rayner '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Versions ' '
dim Ver$ = "0.0.1" '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Setup '
WindowTitle("SleeperRPG " + Ver$) '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Texture Variables
dim tex(10), player, PosX, PosY \
PosX = 320
PosY = 240
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Sound Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' LoadTextures
Tex(0) = LoadTex("Graphics/Player.jpg")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Load Sounds
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Intro
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Main Menu
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Game
player = NewSprite(Tex1)
SprSetSize(32,32)
BindSprite(player)
While True
SprSetPos(PosX,PosY)
if ScanKeyDown(VK_UP) then
PosY = PosY + 5
endif
wend
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
So is there any other better way to keep code organised and have movement?
Also how do you calculate framerate and how do you make objects move at a certain framerate?
regards
Wayne Rayner