Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Slowing down specific movements

Author
Message
LeeTC
17
Years of Service
User Offline
Joined: 20th Oct 2006
Location:
Posted: 20th Oct 2006 09:35
Hi all.

I'm trying to create a clone of Space Invaders. I want the aliens to move at a slower pace than the gun. I've tried using a sleep command in the loop, but obviously this effects the speed of the gun movement as well as the aliens.

Here's my code so far:



Any advice would be greatly appreciated!

Cheers,
Lee
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Oct 2006 13:37
The crux of this matter is here...

if aliendir = 1 then alienx = alienx + 20

and here...

if gunx => screen width()/5 and leftkey() then gunx = gunx - 10

By changing the 20 to a lower value, your aliens will move slower.
By changing the value -10 to a higher value, it will move faster.

if aliendir = 1 then alienx = alienx + 10
if gunx => screen width()/5 and leftkey() then gunx = gunx - 20



LeeTC
17
Years of Service
User Offline
Joined: 20th Oct 2006
Location:
Posted: 20th Oct 2006 13:53
D'oh! Many thanks mate!

Login to post a reply

Server time is: 2024-09-25 11:28:50
Your offset time is: 2024-09-25 11:28:50