The Daily Click ::. Forums ::. Klik Coding Help ::. How to Turn One Object into a Different One & Use WASD
 

Post Reply  Post Oekaki 
 

Posted By Message

qwertail



Registered
  21/11/2017 20:11:37
Points
  3
21st November, 2017 at 21/11/2017 21:13:49 -

Hi, I'm having trouble making it so that one object changes into a different one when it collides into something. Is there any action I can use to do that? For overlapping objects, can I just change the overlapping section?
Also, how do I change the controls for movement from arrow keys to WASD?
I'm using the free version, if that changes anything.

 
O~O

qwertail



Registered
  21/11/2017 20:11:37
Points
  3
22nd November, 2017 at 22/11/2017 15:41:13 -

OK, I found a solution for my first problem (destroy the object & put a new one in its place), but I still need to know how to make two objects overlapping into a new object in the cross-section only and how to change controls (specifically 8-direction movement) from arrows to WASD.

 
O~O

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49528

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 33 Winner!Picture Me This Round 32 Winner!Santa!Box BlueAngelBellBox GreenBox OrangeBox PurpleBox Red
Box YellowCandleCandy CaneChristmas TreeDrumGingerbread HouseGingerbread ManHollyLight Oval BlueLight Oval Green
Light Oval OrangeLight Oval PurpleLight Oval RedLight Oval YellowOrnament GoldOrnament GreenOrnament RedReindeerRibbonSanta Boot
Santa GloveSanta HatSanta SockSantaSanta SkateSnowSnowmanStarTeddy Bear
22nd November, 2017 at 22/11/2017 15:41:34 -

Do you actually want the object to turn into a different one, or do you just want the graphic to change?

There are a couple of ways to have the graphic change. You could create a new animation for the object and have it change to that animation, or you could store the graphic in a different direction and use the action to change the object's direction.

If you actually want to swap the object with another one simply create the new object at the same location as the old one and destroy the old one.

For the controls go to the application's properties and then select the runtime tab. At the bottom is a button that lets you modify the default controls.

 
http://www.soapcow.com <- Flash games, featuring MMF made games!
http://www.jsoftgames.com <- Old blog I don't keep up anymore
http://www.rodentrush.com <- My best iphone game, made with Fusion.

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49528

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 33 Winner!Picture Me This Round 32 Winner!Santa!Box BlueAngelBellBox GreenBox OrangeBox PurpleBox Red
Box YellowCandleCandy CaneChristmas TreeDrumGingerbread HouseGingerbread ManHollyLight Oval BlueLight Oval Green
Light Oval OrangeLight Oval PurpleLight Oval RedLight Oval YellowOrnament GoldOrnament GreenOrnament RedReindeerRibbonSanta Boot
Santa GloveSanta HatSanta SockSantaSanta SkateSnowSnowmanStarTeddy Bear
22nd November, 2017 at 22/11/2017 15:46:48 -


Originally Posted by qwertail
but I still need to know how to make two objects overlapping into a new object in the cross-section only



You want to create a new object precisely between the two objects?

This might be a little difficult for a newbie, but it's possible.

How difficult it'll be to code depends on whether or not the two object colliding are two instances of the same object or two different objects.

If it's two different objects create your new object relative to one of the objects colliding and then calculate how much on the X and Y axis you need to shift it's position to be between the two objects. This is pretty easy, just subtract the two object's X and Y position and divide that number by 2.

If it's two instances of the same object you'll need to use the condition "Pick one at random" to select only 1 of the instances and do the same as above.



 
http://www.soapcow.com <- Flash games, featuring MMF made games!
http://www.jsoftgames.com <- Old blog I don't keep up anymore
http://www.rodentrush.com <- My best iphone game, made with Fusion.

qwertail



Registered
  21/11/2017 20:11:37
Points
  3
22nd November, 2017 at 22/11/2017 16:58:23 -

Firstly, thanks for the help with WASD!

Secondly, I'd have to make the X/Y values variables, so how and where would I code it? (If its manual and not just some feature I'm missing, I don't know too much about that.) And the X and Y values would be separate values, separately subtracted & divided, right?

 
O~O

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49528

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 33 Winner!Picture Me This Round 32 Winner!Santa!Box BlueAngelBellBox GreenBox OrangeBox PurpleBox Red
Box YellowCandleCandy CaneChristmas TreeDrumGingerbread HouseGingerbread ManHollyLight Oval BlueLight Oval Green
Light Oval OrangeLight Oval PurpleLight Oval RedLight Oval YellowOrnament GoldOrnament GreenOrnament RedReindeerRibbonSanta Boot
Santa GloveSanta HatSanta SockSantaSanta SkateSnowSnowmanStarTeddy Bear
27th November, 2017 at 27/11/2017 17:28:03 -

You don't have to make them variables since they're already stored in the object as part of their position in the frame.

In the expression editor you can just retrieve them and use them in your expression. You can also edit them directly to re-position objects.

And yes they're separate values so you'll need an action for each of them.

So you would do something similar to this:

-Set X position to
X position("this object") + ((X position("other object") - X position("this object")) / 2)

-Set Y position to
Y position("this object") + ((Y position("other object") - Y position("this object")) / 2)

 
http://www.soapcow.com <- Flash games, featuring MMF made games!
http://www.jsoftgames.com <- Old blog I don't keep up anymore
http://www.rodentrush.com <- My best iphone game, made with Fusion.
   

Post Reply



 



Advertisement

Worth A Click