The Daily Click ::. Forums ::. Klik Coding Help ::. mOVE IN DIRECTION
 

Post Reply  Post Oekaki 
 

Posted By Message

Fish20



Registered
  03/12/2007
Points
  255

VIP MemberPS3 OwnerI like Aliens!I'm a Storm TrooperIt's-a me, Mario!I am an April FoolPicture Me This Round 48 Winner!
2nd January, 2008 at 16:29:12 -

How could i make a movement when you press left or right you change the direction,but when you press Up you go in the selected direction simalar to the built in Race car movement.

 
All your base are in another castle, take this.

jpSoul



Registered
  25/10/2003
Points
  1714
2nd January, 2008 at 17:23:44 -

for up and down you can do a thing like this: when you press the key => set dir(active) to dir(active) +1 (or -1 to go in the other direction)

to "swap" your direction it's more difficult, it require more events:
example to reverse the direction when you press the left arrow:


upon pressing left
+
dir(active)> 0
+
dir(active)< 8
=> dir(active) = 16 - dir(active)


upon pressing left
+
dir(active)> 24
+
dire(active)<= 32
=> dir(active) = 24 -( dir(active) -24)



it's only for the left, you have to add 2 events for the right

I've not tried this code, but I think it would work...

 
n/a

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
2nd January, 2008 at 17:32:36 -

I'm not sure exactly what kind of movement you want as an end result. It would be easier if you described it more in-depth.

If all you want is a 2 directional movement (left or right), where up travels forwards and left/right change directions, you can simply do this:


+Upon Pressing Left
=Set Flag 1 OFF;

+Upon Pressing Right
=Set Flag 1 ON;

+Repeat Upon Pressing Up
+Flag 1 is OFF
=Set Position of PLAYER to PosX(Player) - 1;

+Repeat Upon Pressing Up
+Flag 1 is ON
=Set Position of PLAYER to PosX(Player) + 1;




Alternatively, if it is more to your tastes, you can alter the "Upon Hitting Left/right" Code to be "Toggle Flag 1" instead of "Set Flag 1", which will make it more like the race car movement.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14456

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
2nd January, 2008 at 20:26:53 -

i assume he means left or right rotates and up moves in the direction you're facing.

 
.

jpSoul



Registered
  25/10/2003
Points
  1714
3rd January, 2008 at 04:16:34 -

I thaught he wanted to do a sort of shoot-platformer game. for example the player have a gun, he can move it up and down (to target), but the gun direction have to be reversed according to the direction of the player (facing to right or facing to left)

Image Edited by the Author.

Image Edited by the Author.

 
n/a

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
3rd January, 2008 at 04:54:58 -

Please clarify, since no-one seems to know what you mean fish20?

 
Image
http://bfollington.tumblr.com

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14456

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
3rd January, 2008 at 10:44:32 -

the 'simalar to the built in Race car movement' part is a bit of a clue though lol.

 
.
   

Post Reply



 



Advertisement

Worth A Click