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 / Select Sprites with number keys

Author
Message
Bozzy
18
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 10th Oct 2006 22:07
Can you guess what the theme to my questions are yet? Anyway I need to know how to select a sprite with a number key and then move it individually...

Heres some code unfinished


game:
do

`Unit Controls
gosub unitcontrols

`Select Units
gosub unitselect


unitcontrols:
if upkey() then move sprite n,5
if downkey() then move sprite n,-5
if leftkey() then rotate sprite n,wrapvalue (-5)
if rightkey() then rotate sprite n,wrapvalue (5)
return

unitselect:

Bozzy
Bob_42
18
Years of Service
User Offline
Joined: 15th Sep 2006
Location: Guernsey
Posted: 11th Oct 2006 00:48
you would simply put this in the loop:



the number in the keystate function is the key that you want pressed, this is the position of the key not the face value...

Bozzy
18
Years of Service
User Offline
Joined: 10th Sep 2006
Location: Birmingham, UK
Posted: 11th Oct 2006 00:55
oooooooooo i get it now. Quite simple really lol
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 11th Oct 2006 10:41
or to save some typing:



Login to post a reply

Server time is: 2024-09-25 09:39:11
Your offset time is: 2024-09-25 09:39:11