Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Need help getting the Badniks to shoot projectiles in an arc.


Recommended Posts

I've been working with the Sonic Worlds engine for a while, and I've got the Crabmeat Badnik shooting the bullets, but they're being launched diagonally outward. I want them to launch in an arc like in the Genesis games, but I can't figure out how.

I tried setting the Y position as a parabola formula, but that didn't work; it just made the bullet disappear.

Does anyone here know how to get the bullets to launch in an arc shape? I've got some other Badniks planned for my game that will launch projectiles in arcs, as well, so this is going to help me a lot.

Link to comment
Share on other sites

Just apply simple gravity.

When the bullets shoots, set both to have a negative Y speed and inverse X speeds. Then have the Y speed ( which should be stored in an alterable value within the bullet object itself ) always increase by a certain amount ( I like 0.314 ).

To position the bullet, have two alterable values in charge of the X and Y positions of the bullet. When the bullet is created, set these values to its current position. Then, always add the X and Y speeds to the appropriate position values. MAKE SURE to do this by using the 'set value' perimeter; add or subtract remove the decimal data of the value. Finally, always set the position of the bullet to its X and Y position values.

Just make sure that when the bullets are shot that you set the speed values accordingly and set up the position values as soon as they're created. Should work fine if you do it correctly.

Link to comment
Share on other sites

I'm not sure how to make the inverse X speed, so, Appo, if you could post the example, that would really help me understand. Thanks.

Though Appo already posted a tutorial ( which is worth more than a thousand words imo ), inverse X speed isn't really any matter of difficulty. Simply put, if a positive X speed value moves to the right, then a negative X speed value will go to the left. So to inverse the X speed, simply set a negative value.

Doesn't get much easier than that. =P

  • Like 1
Link to comment
Share on other sites

Appo, I used your example and placed it into Sonic Worlds, but the bullet's movement is different. Instead of going in an arc, it just shoots down. However, it does shoot at the same speed as it did in your example. I'm thinking that your alterable values might be different from Sonic Worlds' alterable values. Did you use different alterable values in your example?

Well, for now, I'll try your idea next, Sockman.

EDIT: Sockman, you are a genius. It works! It actually works! :D

Of course, I couldn't have got the whole thing to work without LarkSS or Appo, either. I'm not kidding; both of your ideas helped with this, especially Appo's example. For that, I'm giving all three of you rep points. Thanks so much for the help!

Link to comment
Share on other sites

Well, the ball effect is the closest I've come to getting the arc. The example only made it shoot downward, and I don't know how to make it shoot up and outward at the same time it shoots down. The example worked on its own program, but when placed in the Worlds engine, it was different.

I think it has something to do with the alterable values, but I don't know if those values can be changed, or if they're all the same, but with different functions.

Link to comment
Share on other sites

Actualy that did happen when i first mdae it but i fixed it, however i didn't try it in the worlds engine which i should of done really, but if you would like i'll have a paly with it in the worlds engine unless your happy with Sockmans idea :)

EDIT: Hmm ok so i played around with it a bit and it works, but it will only create bullets from the first enemy you encounter i can't seem to figure out what is going on because it works in a blank application, anyways i'll upload the file and hopfully someone can point out what went wrong, just copy the two bullets in the level editor into the worlds engine then in the events just copy the parts out of the firing bullets group :)

Crabmeat shoot.mfa

Link to comment
Share on other sites

Well, I just tried it, and it works beautifully; I didn't have any problem with the other Badniks shooting bullets, so maybe there's a condition missing from your engine or there's an extra condition that's causing it to happen.

My first theory was that the "only one action when event loops" condition was causing it, as I didn't use the first one in your example, and my engine works fine; but when I tested my theory on your example file, the Crabmeat started shooting lasers, Gradius-style! :D

So yes, I have confirmed that the reason the bullets work differently on the two files is because the alterable values between the two are translated differently. Thank you for checking that, Appo. :)

Link to comment
Share on other sites

np, would it be possible for you to posst a screen shot of the event you put it because if i take the loop only on event out it works on all the crabs but i get the 'Gradius-style' effect but when i put it in it works properly but onl on the first crab unless i destoy it....which is weird :S

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...