Post by Wayne Rayner on May 10, 2010 11:54:23 GMT -5
Ok well I got this problem and well I hope someone can help me out here. My character ain't moving.
The problem I also have here is that my code is included in different files for ease of access. so here is the source code of the two parts that are giving me problems.
Main.gb
engine.gb
I hope someone can help me.
Yours wayne Rayner
P.S. If you need the graphics as well I will up load them if it is asked
The problem I also have here is that my code is included in different files for ease of access. so here is the source code of the two parts that are giving me problems.
Main.gb
' Set-Up
WindowTitle ("Basic RPG Engine 0.01")
ResizeSpriteArea (800,600)
ResizeText(WindowWidth()/16,WindowHeight()/16)
' General Variables
dim Cursor(1), buttonactive
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Input Variables
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Texture Variables
dim Tex(10), MenuBackground, New, Load, Options, Credits, Exit
dim Character
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Load Textures
Tex(0) = LoadTex ("Resources/Graphics/MenuBackground.png")
Tex(1) = LoadTex ("Resources/Graphics/New.png")
Tex(2) = LoadTex ("Resources/Graphics/Load.png")
Tex(3) = LoadTex ("Resources/Graphics/Options.png")
Tex(4) = LoadTex ("Resources/Graphics/Credits.png")
Tex(5) = LoadTex ("Resources/Graphics/Exit.png")
Tex(6) = LoadTex ("Resources/Graphics/Character.png")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Structures
Struc sPlayer
dim posx#
dim posy#
dim health
dim level
dim walkSpeed
endStruc
dim sPlayer Player
Player.posx# = 400
Player.posy# = 300
Player.health = 20
Player.level = 1
Player.walkSpeed = 5
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Menu
MenuBackground = NewSprite (Tex(0))
SprSetSize (800,600)
SprSetPos (400,300)
SprSetZOrder (1)
BindSprite (MenuBackground)
New = NewSprite (Tex(1))
SprSetSize (200,50)
SprSetPos (400,100)
BindSprite (New)
Load = NewSprite (Tex(2))
SprSetSize (200,50)
SprSetPos (400,200)
BindSprite (Load)
Options = NewSprite (Tex(3))
SprSetSize (200,50)
SprSetPos (400,300)
BindSprite (Options)
Credits = NewSprite (Tex(4))
SprSetSize (200,50)
SprSetPos (400,400)
BindSprite (Credits)
Exit = NewSprite (Tex(5))
SprSetSize (200,50)
SprSetPos (400,500)
BindSprite (Exit)
while true
cursor(0) = Mouse_X()*800
cursor(1) = Mouse_Y()*600
if cursor(0)>(SprLeft(New)) and cursor(0)<(SprRight(New)) and cursor(1)>(SprTop(New)) and cursor(1)<(SprBottom(New)) then
buttonactive = 1
elseif cursor(0)>(SprLeft(Load)) and cursor(0)<(SprRight(Load)) and cursor(1)>(SprTop(Load)) and cursor(1)<(SprBottom(Load)) then
buttonactive = 2
elseif cursor(0)>(SprLeft(Options)) and cursor(0)<(SprRight(Options)) and cursor(1)>(SprTop(Options)) and cursor(1)<(SprBottom(Options)) then
buttonactive = 3
elseif cursor(0)>(SprLeft(Credits)) and cursor(0)<(SprRight(Credits)) and cursor(1)>(SprTop(Credits)) and cursor(1)<(SprBottom(Credits)) then
buttonactive = 4
endif
if Mouse_Button(0) = true and buttonactive = 1 then
DeleteSprite (MenuBackground)
DeleteSprite (New)
DeleteSprite (Load)
DeleteSprite (Credits)
DeleteSprite (Options)
DeleteSprite (Exit)
goto New:
elseif Mouse_Button(0) = true and buttonactive = 2 then
DeleteSprite (MenuBackground)
DeleteSprite (New)
DeleteSprite (Load)
DeleteSprite (Credits)
DeleteSprite (Options)
DeleteSprite (Exit)
elseif Mouse_Button(0) = true and buttonactive = 3 then
DeleteSprite (MenuBackground)
DeleteSprite (New)
DeleteSprite (Load)
DeleteSprite (Credits)
DeleteSprite (Options)
DeleteSprite (Exit)
goto Options:
elseif Mouse_Button(0) = true and buttonactive = 4 then
DeleteSprite (MenuBackground)
DeleteSprite (New)
DeleteSprite (Load)
DeleteSprite (Credits)
DeleteSprite (Options)
DeleteSprite (Exit)
goto Credits:
endif
wend
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' New
include include/engine.gb
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Load
include include/Load.gb
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Options
Options:
Printr "No Options yet"
end
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Credits
Credits:
Printr "Credits"
Printr "Created by The Drunken Programmer and Parabotai Studios"
Printr "DJLinux's Toolbox plugin"
end
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
engine.gb
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The Game Engine
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
New:
Character = NewSprite (Tex(6))
SprSetPos (Player.posx#, Player.posy#)
BindSprite (Character)
' Very Basic Movement
if ScanKeyDown (VK_UP) then
Player.posy# = Player.posy# - Player.walkSpeed
endif
if ScanKeyDown (VK_DOWN) then
Player.posy# = Player.posy# + Player.walkSpeed
endif
if ScanKeyDown (VK_RIGHT) then
Player.posx# = Player.posx# + Player.walkSpeed
endif
if ScanKeyDown (VK_LEFT) then
Player.posx# = Player.posx# - Player.walkSpeed
endif
I hope someone can help me.
Yours wayne Rayner
P.S. If you need the graphics as well I will up load them if it is asked