Posted: Thu Jun 02, 2005 9:14 am Post subject: CHARS?
I would like to know what the chars for Ctrl and also for Alt???
Sponsor Sponsor
lyam_kaskade
Posted: Thu Jun 02, 2005 9:22 am Post subject: (No subject)
They don't have chars. If you want to use them use Input.KeyDown[/code]
[Gandalf]
Posted: Thu Jun 02, 2005 11:44 pm Post subject: (No subject)
Use KEY_CTRL and KEY_ALT when using Input.Keydown.
code:
if keys (KEY_CTRL) then
put "Ctrl has been presssed"
[/code]
gohan
Posted: Fri Jun 03, 2005 8:31 am Post subject: (No subject)
Oh yeah...I forgot that I put this down....but it's here now soo...how would i use the space bar?
And can I use the shift button and use the arrow keys at the same time?
lyam_kaskade
Posted: Fri Jun 03, 2005 9:42 am Post subject: (No subject)
yes.
code:
Input.KeyDown (keys)
if keys (KEY_SHIFT) and keys (KEY_DOWN_ARROW) then
put "yes"
end if
I don't think theres a key for spacebar, but I could be wrong.[/code]
StarGateSG-1
Posted: Fri Jun 03, 2005 9:54 am Post subject: (No subject)
Yes there is a space but it is :
code:
ORD_SPACE
gohan
Posted: Fri Jun 03, 2005 10:36 am Post subject: (No subject)
Hey, how would I use the space though...because It is different then...
code:
Input.KeyDown (chars)
This code that im going to put down is for my RPG Final Project....I need help on a few things!!! I got some of the code from a tutorial...I got a little help from it!!
|1| I would like to know how to use the space bar
|2| I would like to know if I can hold my SHIFT button down(Stay invisible until I let go)
|3| I would like to know if I can hold SHIFT + Arrow Keys (Move,While Inivisible)
|4| and last, and prolly not lease... I would like to keep the circle to stay on the screen!!
code:
var x, y : int
x := 4
y := 4
var bc : int := black
var chars : array char of boolean
loop
Input.KeyDown (chars)
drawfilloval (x, y, 4, 4, brightred) % IT's the character
delay (10)
cls
colourback (black)
if chars (KEY_UP_ARROW) then % MOVE UP
y := y + 3
end if
if chars (KEY_RIGHT_ARROW) then % MOVE RIGHT
x := x + 3
end if
if chars (KEY_LEFT_ARROW) then % MOVE LEFT
x := x - 3
end if
if chars (KEY_DOWN_ARROW) then % MOVE DOWN
y := y - 3
end if
if chars (KEY_ENTER) then % TELEPORT BACK TO START POINT
x := 4
y := 4
end if
if chars (KEY_SHIFT) then % TURN INVISIBLE
for q : 1 .. 10
drawoval (x, y, 4 + q, 4 + q, bc)
delay (50)
end for
end if
if chars (KEY_ALT) then % SPECIAL FEATURE (not decided yet)
for w : 1 .. 10
drawoval (x, y, 4 + w, 4 + w, white)
delay (50)
end for
end if
if chars (KEY_CTRL) then % SPECIAL FEATURE (not decided yet)
for e : 1 .. 10
drawoval (x, y, 4 + e, 4 + e, white)
delay (50)
end for
end if
end loop
It would be kind if some pplz would help me and all of my problems...Plzz and Thnxx
StarGateSG-1
Posted: Fri Jun 03, 2005 11:10 am Post subject: (No subject)
I told you how to use space bar:
code:
ORD_SPACE
for the shift do it like this:
code:
if chars = (KEY_SHIFT) then
if invisiblity = false
invisiblity := true
elsif invisiblity = true then
invisiblity := false
end if
if you do the invisiblity like that then you can move.
For the circle to stya on the screen just check if the cirlce radius is outsdie of the screen if it is don't let them move in that direction any more.
Sponsor Sponsor
gohan
Posted: Fri Jun 03, 2005 1:01 pm Post subject: (No subject)
what would the variable be called for
code:
ORD_SPACE
Quote:
For the circle to stya on the screen just check if the cirlce radius is outsdie of the screen if it is don't let them move in that direction any more.
I not sure what you mean???
but thnx for the invisibility tip!!
lyam_kaskade
Posted: Fri Jun 03, 2005 1:20 pm Post subject: (No subject)
Check to make sure the radius of the circle (4) is not outside the boundaries of the screen (maxx and maxy)
ie.
code:
x+4 <maxx and x-4>maxx
y+4 <maxy and y-4>maxy
If it is outside the screen boundaries then just keep x or y from increasing.
[Gandalf]
Posted: Fri Jun 03, 2005 3:21 pm Post subject: (No subject)
Ahh, I was going to post this in my example code, but I was feeling lazy...
The easiest way of detecting the spacebar key is:
code:
if keys (' ') then
put "Space Bar has been presssed"
The '' signs mean that the character inside is what will be detected, if the key does have a character. Like so:
code:
if keys ('a') then
put "a has been pressed"
elsif keys (KEY_CTRL) then
put "The ctrl key has been pressed."
end if
syphon4
Posted: Fri Jun 03, 2005 3:44 pm Post subject: chars
locate (1, 1)
for key : 0 .. upper (keys)
if a (keys (key).character) then
put ord (keys (key).character), ": ", keys (key).name, " " ..
end if
end for
put ""
end loop
..............and culd anyone make me a good luigi character and give me the code plz and thank you
Bacchus
Posted: Sat Jun 04, 2005 12:38 am Post subject: (No subject)
Bloody Hell, if you really want a good Luigi, just learn how to use Pictures!
gohan wrote:
|1| I would like to know how to use the space bar
|2| I would like to know if I can hold my SHIFT button down(Stay invisible until I let go)
|3| I would like to know if I can hold SHIFT + Arrow Keys (Move,While Inivisible)
|4| and last, and prolly not lease... I would like to keep the circle to stay on the screen!!
|1| Gandalf had it right its just ' ', like any other key that returns a character.
|2| In your main loop just have a check to see if the key is down.
code:
loop
Input.KeyDown(chars)
if chars(KEY_SHIFT) then
invis:=true
else
invis:=false
end if
if ~invis then
draw.character
end if
end loop
|3| Stick the Keys in different If statments, it will get them all.
|4| 2 ways, Either when you draw the cirlce check to see if it would be below 0 or above the maxx/maxy and draw it inside. Or do a check when they press a button and don't change the x/y if it would go out.
gohan
Posted: Mon Jun 06, 2005 8:53 am Post subject: (No subject)
Quote:
Bloody Hell, if you really want a good Luigi, just learn how to use Pictures!
What the heck is that??
|1| check
|2| no check (what kind of var would be invis?)
|3| no check (I can't get the circle to move, while invisible)
|4| no check (I still don't get how to keep my circle to stay on the screen)
Bacchus
Posted: Mon Jun 06, 2005 3:09 pm Post subject: (No subject)
lol That was for syphon4, not you.
Here like this:
code:
setscreen ("graphics,offscreenonly")
var x, y : int := 20
var invis : boolean := false
var chars : array char of boolean
loop
cls
Input.KeyDown (chars)
invis := false
if chars (' ') then
invis := true
end if
if chars (KEY_RIGHT_ARROW) & x + 5 <= maxx then
x += 5
elsif chars (KEY_LEFT_ARROW) & x - 5 >= 0 then
x -= 5
end if
if chars (KEY_UP_ARROW) & y + 5 <= maxy then
y += 5
elsif chars (KEY_DOWN_ARROW) & y - 5 >= 0 then
y -= 5
end if
if ~invis then
drawfilloval (x, y, 5, 5, 2)
end if
View.Update
delay (10)
end loop