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.

DarkBASIC Professional Discussion / How do i make a character move/run with any other button

Author
Message
Andrew
22
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: United Kindom (what makes it important?)
Posted: 15th Sep 2003 20:54
Like if i wanted to make a character run, i have the baisc's on how to do it, but i want to know what sort of code i will need if i want him to run with a letter on the keyboard like "a"?
adr
23
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 15th Sep 2003 21:01 Edited at: 15th Sep 2003 21:01
long answer:
You may want to consider posting such questions to the newcomer's
forum. You're more likely to get a thorough, thought out, tutorial-like answer.

short answer:
look up "scancode" and "keystate"...
30 is the scancode for "a" so you can do something like:

if keystate(30) = 1 then postOnForum()

A wise man once said: "I know that I need codes but I dont know the codes"
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Sep 2003 22:00
An easy-to-use command would be inkey$(), however that will not work when multiple keys are pressed so you'll most likely have to use a command such as keystate().

c:/dos
c:/dos run
run dos run
Andrew
22
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: United Kindom (what makes it important?)
Posted: 16th Sep 2003 19:14
How do i know what number means that letter like:
if keystate(number) = then move object, number, number : run=3
The (number), how do i know what number means that letter?
It says in the manual, from the top left going across then down, i see that 30 is a so would 36 mean j ?
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 16th Sep 2003 19:30
someone here may have a scancode sheet they could post, or just write a program that is basically a loop that checks the scancode of the key being pressed and displays it on the screen. You could go thru all the keys on the keyb or just the ones you want to use and write down (or write to a file) the valuse - then you'd know what was what

-RUST-
Andrew
22
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: United Kindom (what makes it important?)
Posted: 16th Sep 2003 19:47
Another question.
Say i want my main character to attack, if i have:
attack=0
And then make something like:
If controlkey()=1 then move object 1,0 : attack 1
Or would i need to make the character loop like
If controlkey()=1 then loop object 1,0 : attack 1
Andrew
22
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: United Kindom (what makes it important?)
Posted: 16th Sep 2003 19:50
Woops, that code is wrong isn't it, i would have to have something like
If controlkey()=1 then attack=1
This is better right?
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 16th Sep 2003 22:18
Don't know, haven't seen you code. But the controlkey() bit was right.

c:/dos
c:/dos run
run dos run
zircher
23
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Sep 2003 03:46 Edited at: 18th Sep 2003 03:48
FYI, "attack = 1" is just you assigning a value to a variable. It does NOTHING until you add some code to actually do something with that value.

For example...


--
TAZ
Andrew
22
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: United Kindom (what makes it important?)
Posted: 18th Sep 2003 12:58 Edited at: 18th Sep 2003 13:24
Do you know when the character attacks, would i need to place the attacking mode code and animation like this:

health=200
attack=0
walk=0
if upkey()=1 then loop object 1,4 : walk=1
if keytstate(33)=1 then attack=1

Then have the animation for character
Animations go here for walk, run

Then have the attacking mode here.
Like the colliding, if collide what happens to the enemy
(if i had different enemy's would i place each collide here?)

Then have control enemys here

Then have animation for enemy here

Then have enemys attack mode here
Like if the object collides

Does this look ok, and what about the different enemys? would i make mult collides in the same place?

Thanks -
Andrew
Dent
23
Years of Service
User Offline
Joined: 18th Jul 2003
Location:
Posted: 19th Sep 2003 19:45
No offense, but I just think you should write your own game

Login to post a reply

Server time is: 2026-07-25 07:01:31
Your offset time is: 2026-07-25 07:01:31