The Daily Click ::. Forums ::. Klik Coding Help ::. 360 Degree Active Object Rotation.
 

Post Reply  Post Oekaki 
 

Posted By Message

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 16:22:02 -

Wasnt there once an object which could auto generate the graphics realtime for rotating an object 360 degree?

If thats the case which.

Hugs Tina

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
20th August, 2006 at 16:33:03 -

In TGF: You can't, as far as I know.
In MMF: Active picture object, but I'd rather use Alpha Channel Object, because it can store images internally plus lots of other features.
In MMF2: All Active Objects can be scaled and rotated in runtime.

Image Edited by the Author.

 
n/a

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 16:37:26 -

the only problem i got with Alpha is action point where which how.. can it be done.. requires some extreme calculation doesnt it?

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
20th August, 2006 at 16:41:47 -

Action point? You mean hot spot, or do you want to shoot stuff with it? Because I'd just do the shooting by creating the bullets or whatever on the object, and then moving them with Sin and Cos and all that shite.

Image Edited by the Author.

 
n/a

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 17:00:45 -

I found it easy to just move the hotspot of the bullet.. Since its 100% topdown shooter this is the easiest way i think..

Another thing.. when i use direction calculator it turns the opposite way.. Any ideas on that?

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
20th August, 2006 at 17:04:44 -

invert your math?

 
Craps, I'm an old man!

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 17:08:19 -

dont see how
Direction( "Advanced Direction Object", X( "Active" ), Y( "Active" ), X( "Alpha Channel object" ), Y( "Alpha Channel object" ) )
is invertable it will just make it a few angles lower and still turn the opposite direction of my mouse.

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 17:10:07 -

God genius.. Thanx mate

found it

Direction( "Advanced Direction Object", X( "Active" ), Y( "Active" ), X( "Alpha Channel object" ), Y( "Alpha Channel object" ) )
-
Direction( "Advanced Direction Object", X( "Active" ), Y( "Active" ), X( "Alpha Channel object" ), Y( "Alpha Channel object" ) )
-
Direction( "Advanced Direction Object", X( "Active" ), Y( "Active" ), X( "Alpha Channel object" ), Y( "Alpha Channel object" ) )
makes it turn the right way

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
20th August, 2006 at 17:10:27 -

What about expression*-1 ?

EDIT: k, nevermind. What I suggested would probably show it on the other side anyway.

Image Edited by the Author.

 
Old member (~2004-2007).

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 17:14:27 -

- 3 times and yeah the angle goes negative and therefore the right way.. Now my mouse was off by 90 angle. but just added + 90. Now the direction is 100%

Yeah alpha is nice i see now.. makes games smaller etc, and best thing is it can reverse animations.. now thats kewl being able to ping pong frames to save kb's. Only bad thing is alpha is required.

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 17:55:33 -

I just tested that Phizzy. i loose 2-3% more cpu using alpha. So yes slows it down.. but 45% not really. not for me anyways.

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
20th August, 2006 at 17:57:28 -

Yeah, Alpha Channel Objects work fine, as long as you don't have like hundreds of them flying around on the playfield.

 
n/a

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 18:01:02 -

yeah and the size..

Before with 32 direction with 20 frames of idle, 9 frames of walking anim
= 438kb uncompressed

now with 320 direction with 20 frames of idle and 9 frames of walking anim
Including 2 alphas. Normal and 1 for when u turn into a ghost.
= 86kb uncompressed

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

Dustin Gunn

Gnarly Tubular Way Cool Awesome Groovy Mondo

Registered
  15/12/2004
Points
  2659

Game of the Week WinnerKlikCast StarVIP MemberI'm on a BoatGOTW Winner Oct 2010Kliktober Special Award Tag
20th August, 2006 at 18:02:07 -

Alpha Channel Object uses backwards calculations for some reason. When MMF2 came out and I converted them to active objects I had to change all the values.

You could always do what a lot of earlier 2D games did and prerender all the rotations, but it takes tons of space, obviously.

 
n/a

Tina Petersen



Registered
  19/09/2003
Points
  350
20th August, 2006 at 19:03:10 -

1 more question tonight.. For the machine gun which should fire loads of bullets i dont wanna use alpha, to many objects at a time i think.. How do i do 360 degree bullet fire. is there an extension. Ive tried sine/cos but cant figure that out.

Hug. Tina

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
21st August, 2006 at 01:11:48 -

User clicks with left button (That means fire)
-Create Bullet at (0;0) from Player
-Bullet: Set alterable A to Angle("Player")
-Bullet: Set alterable B to X("Player")
-Bullet: Set alterable C to Y("Player")

Number of bullets > 0
-Start loop "bullet" 30 times (Or more, if you want faster bullets)

On loop "bullet"
-Bullet: Set value B to value B("Bullet") + Cos(Value A("Bullet"))
-Bullet: Set value C to value C("Bullet") + Sin(Value A("Bullet"))
-Bullet: Set X position to value B("Bullet")
-Bullet: Set Y position to value C("Bullet")

On loop "bullet"
Bullet collides with backdrop
-Bullet: Destroy

... And so on. I used alterable values because they allow decimals, so it's more accurate than just adding directly to the X and Y position.

 
n/a

Tina Petersen



Registered
  19/09/2003
Points
  350
22nd August, 2006 at 02:25:49 -

Ok this works bad.. sorry. If i turn the player around while bullets are flying.. they all turn around

isnt there a way just to put mouse x+y into the bullets values, and make it look that way all the time? Making the bullet at ball movement object.

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
22nd August, 2006 at 08:40:09 -

If the bullets turn with the player, you've done something wrong.

When the player fires, you should set the bullet's alterable value A (or whatever) to the angle of the player. Then calculate the X and Y position of the bullet NOT from the player's angle directly, but from the bullet's value A.

I'll make an example...

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
22nd August, 2006 at 08:56:01 -

Here: http://aggggge.funpic.org/360shooting.cca

 
n/a

Tina Petersen



Registered
  19/09/2003
Points
  350
22nd August, 2006 at 09:36:25 -

yeah ur example works smooth :/
and done in my eyes exactly the same ..

http://www.befun.dk/JAZ.Simplifiedfortesting.cca

but no luck still.

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)

Tina Petersen



Registered
  19/09/2003
Points
  350
22nd August, 2006 at 09:44:56 -

Works now.. i had moved the hotspot of the bullet to make it better look as it came frmo the barrel.. somehow that interfered and i had to do a few extra calculations.

Image Edited by the Author.

 
- Eternal Life, Or Your Money Back -
http://www.befun.dk/
Currently looking for a home (team)
   

Post Reply



 



Advertisement

Worth A Click