Hi all, Im pretty new to DB but have good experience in C++ and VisualBasic.
My major task is "Modelling Human Behaviour using Computer Gaming Software", however, in the early stages of my project I simply want a sprite to move from one door, through a room, to another door, after a key press. Its 2D and we are looking at the room from the top down...
OK - so my code is going ok-ish! I have the walls built, when I have the sprite positioned as an image, I can have it stood in the first doorway, but cant get it to respond to a key press....or when i have it as a sprite, its never where i want it, but i can make it move!!
its very frustrating, and have used as many examples/tutorials off the forum for help and guidance, but have decided just to throw the question out there for help now!
This code has only the bottom left corner of the walls visible, and when the rightkey is pressed, the sprite does move, but its nowhere near where it should be...
sync on
sync rate 30
color backdrop 0
Position camera 0,50,70,-150
hide mouse
Make object box 1,5,50,0
load image "media\line.bmp",1
Texture object 1,1
position object 1,2.5,25,0
set object collision to polygons 1
Make object box 2,5,50,0
load image "media\line.bmp",2
Texture object 2,2
position object 2,25,2.5,0
zrotate object 2,90
Set object collision to polygons 2
Make object box 3,5,50,0
load image "media\line.bmp",3
Texture object 3,3
position object 3,75,2.5,0
zrotate object 3,90
Set object collision to polygons 3
Make object box 4,5,50,0
load image "media\line.bmp",4
Texture object 4,4
position object 4,97.5,25,0
set object collision to polygons 4
REM Make top wall
Make object box 5,5,50,0
load image "media\line.bmp",5
Texture object 5,5
position object 5,2.5,115,0
set object collision to polygons 5
Make object box 6,5,50,0
load image "media\line.bmp",6
Texture object 6,6
position object 6,25,142.5,0
zrotate object 6,90
Set object collision to polygons 6
Make object box 7,5,50,0
load image "media\line.bmp",7
Texture object 7,7
position object 7,75,142.5,0
zrotate object 7,90
Set object collision to polygons 7
Make object box 8,5,50,0
load image "media\line.bmp",8
Texture object 8,8
position object 8,97.5,115,0
set object collision to polygons 8
load image "media\entity.bmp", 9
color backdrop rgb(255,255,255)
entity_x as float
entity_x = 2.5
entity_y as float
entity_y = 70
exit_x as float
exit_x = 97.5
exit_y as float
exit_y = 70
do
sprite 1,entity_x,entity_y,9
if RIGHTKEY()=1 and entity_x<exit_x
inc entity_x,10
endif
sprite 1,entity_x,entity_y,9
sync
loop
end
Is there anything obvious that I'm doing wrong? Any help is very much appreciated.
Nick Hudson