The Daily Click ::. Forums ::. Klik Coding Help ::. perfect 180 degree turn transition
 

Post Reply  Post Oekaki 
 

Posted By Message

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
4th June, 2006 at 03:27:14 -

does anybody know how i can make it so when you press left and right a line will do a perfect transition from one side to another?
like this:

Image

Image Edited by the Author.

 
Image
http://www.kevinhaag.ca

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
4th June, 2006 at 06:52:24 -

Are we talking with 360 or MMF's 32 angle? Not sure of the answer, but this might help is someone who could help, knew.

 
http://www.facebook.com/truediamondgame

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
4th June, 2006 at 09:39:27 -

Use sin and cos stuff... Something.

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
4th June, 2006 at 11:47:53 -

Why direction calculator?
While pressing right and not facing right: direction = direction - 1
While pressing left and not facing left: direction = direction + 1
Is a better solution

 
n/a

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
4th June, 2006 at 11:52:55 -

If you mean, you don't want to use the (ugly) 32 dir from active objects, then just use an active picture.

 
This space is for rent

The Chris Street

Administrator
Unspeakably Lazy Admin

Registered
  14/05/2002
Points
  48487

Game of the Week WinnerClickzine StaffAcoders MemberKlikCast StarVIP MemberPicture Me This Round 35 Winner!Second GOTW AwardYou've Been Circy'd!Picture Me This Round 38 Winner!GOTM December Third Place!!
I am an April FoolKliktober Special Award Tag
4th June, 2006 at 12:36:18 -

Or Alpha Channel Object.

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
5th June, 2006 at 01:55:53 -

i have TGF not MMF

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
5th June, 2006 at 06:47:52 -

Yeah this is easy enough. On pressing a direction, set an alterable value of that object to the numerical value equivalent to that direction (right=0, up=8, left=16, down=24). Then compare the current direction to this value and rotate towards it in the direction that would take it there closest, either with a couple of events or the Direction Calculator extension.

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
5th June, 2006 at 23:57:54 -

can someone post a .GAM example file? This is the first time I've looked at TGF in months and months and I have forgotten how to do alot of stuff...

(i've bin too busy working on my portable gamecube)

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
6th June, 2006 at 00:03:36 -

I've got an engine I never finished somewhere that does this, but I don't have TGF anymore, sorry.

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
6th June, 2006 at 02:26:08 -

Well does any body have an engine or example .GAM file or can make one that does what I'm asking?

Thanks

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
6th June, 2006 at 03:32:42 -

Here's a method that uses the direction calculator. My version did it without any extensions, but I can't be arsed remembering how exactly:

Keyboard: pressed right
---Active: set alterable value A to 0

Keyboard: pressed up
---Active: set alterable value A to 8

Keyboard: pressed left
---Active: set alterable value A to 16

Keyboard: pressed down
---Active: set alterable value A to 24

[Do the same thing for diagonals if you like]

Direction("Active") <> Alterable Value A("Active")
---Direction Calculator: rotate Active towards direction Alterable Value A("Active")

There, easy. Pretty sure that would work. For the actual movement of Active, either use a custom movement or always set Active to the position of an invisible object with 8-directional movement (or set it to the position of an invisible one with custom movement, which would be ideal for collision detection).

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
6th June, 2006 at 21:05:41 -

i tried that and it didn't work...

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
6th June, 2006 at 23:27:05 -

I just tested it then with exactly those events, and it does work. It even works if you replace

Direction("Active") <> Alterable Value A("Active")

with

NEGATE[(Active) is facing a direction Alterable Value A("Active")]

Surely at least one of those two must work in TGF.

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
7th June, 2006 at 01:03:59 -

Nope it doesn't.

Direction("Active") <> Alterable Value A("Active")

^^You can't make it do the above event....

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
7th June, 2006 at 01:22:13 -

Doesn't TGF have something equivalent to the "compare two general values" trigger?

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
7th June, 2006 at 04:55:59 -

am i supposed to rotate it for all the directions in the animation editor?

 
Image
http://www.kevinhaag.ca

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
7th June, 2006 at 05:01:43 -

i want it to rotate like the gun in this game:

http://www.ugotgames.com/paratrooper.php

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
7th June, 2006 at 05:17:52 -

Wow, that's totally not what everyone though you were asking for.

Yes, you'll need to have an animation for each direction, otherwise there's nothing to display and TGF'll use the next-nearest animation.

To do what you want, you'd probably just need to do something like this:

Keyboard: pressed left
+direction("active")<16
---Active: set direction to direction("active")+1

Keyboard: pressed right
+direction("active")>0
---Active: set direction to direction("active")-1

That'll give you 16 possible directions, but you probably want more. So use an active picture and rotate it to the correct angle in a similar way. For the actual shooting, look up an article on 360 degree bullets.

 
n/a

KevinHaag



Registered
  28/01/2005
Points
  266

VIP Member
11th June, 2006 at 02:53:45 -

i don't think you can have an active picture in TGF... though I could be wrong...

 
Image
http://www.kevinhaag.ca

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
12th June, 2006 at 03:14:35 -

Something I remember doing in TGF for a 360 degree turret was to make the muzzle out of a line of closely-spaced little grey circles that rotate around a central point using trig. There are a couple of ways you can represent it.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click