Set angle of my rocket

Get help using Construct 2

Post » Mon Dec 22, 2014 1:06 am

Hello everyone!


I been working on a little mini experiment, to try to emulate rocket physics using the bullet behavior, and by touching the screen, the sprite will move up and continue to accelerate, and if you stop touching the screen, the sprites speed will eventually slow, and go downward. You may touch the screen again to start thrust.

All of this works, however what if I wanted to change the angle of which the projectile is traveling? I cannot figure out how to do this, ive tried setting the bullets angle of motion differently, that does not work, and rotating the sprites angle does not work, it will rotate the sprite, but the bullets motion doesn't compensate for the angle I adjusted the rocket. (it just travels in the same, straight bullet line) I am not sure if even the bullet behavior is enough to emulate the rocket, would physics work better?

Screenshot of events:

Image


Any help please? :)

I appreciate it!
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Dec 22, 2014 5:23 am

Can you add a Touch event so when you Touch the screen again the rocket will Angle toward Touch.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Dec 22, 2014 5:31 am

jeffige wrote:Can you add a Touch event so when you Touch the screen again the rocket will Angle toward Touch.


Sadly, no I cant. I would overall like to use the phones beta/ gamma orientation to move the rocket. I know touching can change the angle of motion, with the "set angle of motion - angle(Sprite.X,Sprite.Y,Touch.X,Touch.Y)"
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Dec 22, 2014 5:37 am

When testing make sure you use extravagant values to confirm you are indeed not getting what you expect. I should think that physics will be much better for this though. Even custom events would be preferable. Physics is a lot of fun to play with if you haven't tried it and in many ways more intuitive.

I'm not sure what you are trying to accomplish exactly though... Do you want the rocket to change angle counterclockwise?
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Mon Dec 22, 2014 5:57 am

@ruskul

I am not too sure if I should use physics though, as it is CPU intensive for mobile development, that is where I am not sure what to do.



I am trying to allow the player to just press and hold the screen, the thrust increases while holding for a period of time, that already works using the bullet behavior.

Then I want the player to be able to "steer" the rocket counter clockwise and clockwise, by using the mobile device orientation. Like tilting the phone left and right, and it would steer the rocket in both directions. Here is a little sketch in paint in what I am picturing in my head. It is a crude drawing, sorry. :D

Image
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Dec 22, 2014 6:12 am

Update


I did mess around with the physics a bit, I got something what I wanted working, still have to test on mobile
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Dec 22, 2014 6:37 am

Basically, tilting rotates the rocket, and the rocket will go into the direction it is rotated, which I am still having a hard time doing, I am getting somewhere with the physics though with the thrusting physics, I cannot find an example on this forum that covers this, would be useful though!
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Mon Dec 22, 2014 9:31 pm

Anyone know of a solution for realistic rocket physics using gravity, and thrust?

Cannot find any examples on the forums
B
17
S
6
Posts: 348
Reputation: 2,608


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, David181 and 11 guests