Hey guys,
Im working on a project for a game design class and I wanted to experiment with it and see if instead of only having one image "falling" along the Y axis I was going to try to have that same image randomly appear at the top and fall down the Y axis. I have found that this is harder then I thought. My instructor said to you use "clone sprite" command but did not instruct me on how to use it. So its been about 3 hours now and I have not gotten anywhere but the origional assignment.
If anyone could point me in the right direction of the type of code to use or a small "code Snippet" it would help me out a lot.
Thanks
P.S I am using darkBASIC Pro, I also have attached the code for the program im trying to make.
Rem Project: pacman/catapillar
Rem Created: 12/11/2007 9:38:10 AM
`image constants
global IMG_BACKGROUND as word = 1
global IMG_BALL as word = 2
global IMG_PACMAN as word = 5
`paddle position variables
global pacmanX as integer
global pacmanY as integer
`ball position variables
global ballX as integer = 300
global ballY as integer = 1
`global ballSpeedX as integer = 2
global ballSpeedY as integer = 2
`start game running
Init_Game()
Run_Game()
End
function Init_Game()
sync on
sync rate 40
hide mouse
randomize timer()
`load background
load image "pacman800x600.jpg", IMG_BACKGROUND
`load pacman
load image "pacman.png", 5
pacmanX = SCREEN WIDTH() / 2
pacmanY = SCREEN HEIGHT() - 50
`load the random ghost
load image "ghost.png", IMG_BALL
sync on
sync rate 40
endfunction
function Run_Game()
do
`draw background
paste image IMG_BACKGROUND, 0, 0
`random ghosts
random_ghost()
`move pacman with the mouse
Move_Pacman()
`refresh the screen
sync
if escapekey() = 1 then exit
loop
endfunction
function random_ghost()
`move the ghost in the Y direciton
ballY = ballY + ballSpeedY
`draw the ghost
paste image IMG_BALL, ballX, ballY
endfunction
function Move_pacman()
`get mouse movement value
m = mousemovex()
if m <> 0
pacmanX = pacmanX + m
endif
`move the paddle based on mouse movement
if pacmanX < 30 then pacmanX = 30
if pacmanX > screen width() - 75
pacmanX = screen width() - 75
endif
`draw the paddle
paste image IMG_PACMAN, pacmanX, pacmanY
endfunction