| View previous topic :: View next topic |
| Author |
Message |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Fri Dec 02, 2005 11:42 am Post subject: analog stick position |
|
|
ive been working on my drag racer game (on pspupdates if anyone wants to try) ive changed it quite a bit so the old versoin is really basic. one thing i wanted to change was the conrols. i want to give the player a better sense of shifting. ive thought about this and thought it would be cool for major games to use. basically you use the analog stick as the shift knob. my problem....ive never been good with the analog stick. could some one give me the position the stick would have to be in for a basic 6 gear setup like this:
1 3 5
|-|-|
2 4 6
basically i need the corners and center top/bottom. thanks |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Fri Dec 02, 2005 1:35 pm Post subject: |
|
|
| I think you might have some very unsatisfied customers if you do that. people trying to go to 1 will go through thrird if not carefull. Its not exact enough to use it as a "free sliding" stick shift. might i suggest using the shoulder buttons so that people wont end up throwing their PSP's against the wall. |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Fri Dec 02, 2005 2:03 pm Post subject: |
|
|
| i am currently using the shoulder buttons. i just wanted to see how it would control like that. im sure it would be difficult but i wanted to try something different. i would also put in a clutch so there wont be unwanted shifting. you just have to clutch, push the stick in the right region, and release the clutch and let go of the stick. |
|
| Back to top |
|
 |
the-dan
Joined: 21 Jul 2005 Posts: 7
|
Posted: Fri Dec 02, 2005 4:07 pm Post subject: |
|
|
you could just make it a 4speed shifter:
...2
1-|- 4
...3
clutch on Rtrig maybe.. just an idea, but great concept you have goin =) |
|
| Back to top |
|
 |
alexis
Joined: 14 Nov 2005 Posts: 11 Location: between neptune and mars
|
Posted: Fri Dec 02, 2005 5:00 pm Post subject: |
|
|
I personnaly feel it could be quite ergonomic with the analog stick to do somethine like
up rigth : up gear spd from odd to even
down rigth : up gear spd from event to odd
up left : down gear spd from odd to even
down left : down gear spd from even to odd
Regards.
Alexis _________________ Ho no ... !! I make the same bug again !!! |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Sat Dec 03, 2005 7:45 am Post subject: |
|
|
| well im glad some people are agreeing with me (kinda) but does anyone know how to do it? |
|
| Back to top |
|
 |
alexis
Joined: 14 Nov 2005 Posts: 11 Location: between neptune and mars
|
Posted: Sat Dec 03, 2005 9:37 am Post subject: |
|
|
K,
Positions of the stick are from -127 to +127.
left X=-127
rigth X=+127
up Y=-127
down Y=+127
I will folow my idea, so the gear system is not like
1 3 5
|-|-|
2 4 6
But more like that
1 3 5
\/\/\
2 4 6
( outch !! ... cops can supress my licence for less than that !!! :D )
In this case I guess somethink like (I din't execute this code!!) ....
| Code: |
cnt=Controls.read()
if cnt:analogX() > 50 and cnt:analogY() < -50 then
-- up rigth position
if gear==2 or gear==4 then
gear = gear + 1
end
end
if cnt:analogX() > 50 and cnt:analogY() > 50 then
-- down right position
if gear==1 or gear==3 or gear==5 then
gear = gear + 1
end
end
if cnt:analogX() < -50 and cnt:analogY() > 50 then
-- down left position
if gear==3 or gear==5 then
gear = gear - 1
end
end
if cnt:analogX() < -50 and cnt:analogY() < -50 then
-- up left position
if gear==2 or gear==4 or gear==6 then
gear = gear - 1
end
end
|
.... could give you the sensation to drive a pocket car !! :-D
Additionnaly the folowin little piece code could help you to appreciate a little bit more the analog stick:
| Code: |
screen:clear(Color.new(0,0,0))
screen.flip()
screen.waitVblankStart()
cnt = Controls.read()
endloop=false
while not endloop do
cn = Controls.read()
if cn:analogX() ~= cnt:analogX() or cn:analogY() ~= cnt:analogY() or cn ~= cnt then
if cn:select() then endloop=true end
screen:clear(Color.new(0,0,0))
screen:print(10, 10, "xpos=" .. cn:analogX() .. " ypos=" .. cn:analogY(), Color.new(255,255,255))
screen.flip()
screen.waitVblankStart()
end
cnt = cn
end
|
Take fun with it.
Alexis _________________ Ho no ... !! I make the same bug again !!! |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Sat Dec 03, 2005 2:08 pm Post subject: |
|
|
alright thanks for the help. however before i read it i made up my own code. it was really simple once i got the hang of how the stick works. hopefully soon i can implement my sytem into my game. currently i just have it in a seperate file just for testing. i still havent figured out exactly how to work the clutch and such in yet. thatll be tomorrows job. by the way here is the code if anyone was wondering...
| Code: | pad = Controls.read()
dx = pad:analogX()
dy = pad:analogY()
if dx > -129 and dx < -100 and dy < -80 then
gear = 1
elseif dx > -129 and dx < -100 and dy > 80 then
gear = 2
elseif dx > -100 and dx < 100 and dy < -80 then
gear = 3
elseif dx > -100 and dx < 100 and dy > 80 then
gear = 4
elseif dx > 100 and dx < 129 and dy < -80 then
gear = 5
elseif dx > 100 and dx < 129 and dy > 80 then
gear = 6
end
end |
|
|
| Back to top |
|
 |
alexis
Joined: 14 Nov 2005 Posts: 11 Location: between neptune and mars
|
Posted: Sat Dec 03, 2005 10:17 pm Post subject: |
|
|
Great.
I guess now you just have to avoid than the gear go from n to n+k where k>1 or k<-1.
| Code: |
...
if posotion == blablablah
newgear = 3
if math.abs(gear-newgear)==1 then gear=newgear end
end
...
|
Probabely the "blablablah" condition on the position of the stick could be tuned to increase the playability of you drag.
Regards.
Alexis. _________________ Ho no ... !! I make the same bug again !!! |
|
| Back to top |
|
 |
shifty_bill
Joined: 07 Jan 2006 Posts: 8
|
Posted: Tue May 09, 2006 12:59 pm Post subject: |
|
|
hey would you be able to update the six way analog example with one that goes 8 ways? thx in advance
| Code: | dx = pad:analogX()
dy = pad:analogY()
if dx > -129 and dx < -100 and dy < -80 then
playerstance = greendwarfwalknw
moving = true
lastdir = "nw"
reallastdir = lastdir
playerx = playerx - 1
playery = playery - 1
elseif dx > -129 and dx < -100 and dy > 80 then
playerstance = greendwarfwalksw
moving = true
lastdir = "sw"
reallastdir = lastdir
playerx = playerx - 1
playery = playery + 1
elseif dx > -100 and dx < 100 and dy < -80 then
playerstance = greendwarfwalkn
moving = true
lastdir = "n"
reallastdir = lastdir
playery = playery - 1
elseif dx > -100 and dx < 100 and dy > 80 then
playerstance = greendwarfwalks
moving = true
lastdir = "s"
reallastdir = lastdir
playery = playery + 1
elseif dx > 100 and dx < 129 and dy < -80 then
playerstance = greendwarfwalkne
moving = true
lastdir = "ne"
reallastdir = lastdir
playerx = playerx + 1
playery = playery - 1
elseif dx > 100 and dx < 129 and dy > 80 then
playerstance = greendwarfwalkse
moving = true
lastdir = "se"
reallastdir = lastdir
playerx = playerx + 1
playery = playery + 1
elseif dx > 100 and dx < 129 and dy < 80 then
playerstance = greendwarfwalke
moving = true
lastdir = "e"
reallastdir = lastdir
playerx = playerx + 1
elseif dx < -100 and dx > -129 and dy < 80 then
playerstance = greendwarfwalkw
moving = true
lastdir = "w"
reallastdir = lastdir
playerx = playerx - 1
else
moving = false
end
|
i figured it out myself :D |
|
| Back to top |
|
 |
|