PDA

View Full Version : Trying to create shooter,how do i dynamically create objects



rlmergeuser
04-22-2012, 07:42 AM
Hello,

I'm trying to make a top down shooter and I'm trying to figure out how to do bullet firing. Is it possible to dynamically create objects from the script? If not, how would I go about shooting bullets and creating enemies?

katamariUK
04-22-2012, 09:30 AM
The bullets in the 2D Shooter in RedLynx Picks use animation (Object Position Event). They move from the ship's coordinates to a point about 60 metres infront of the ship. It does this with a curve data source on whichever axis controls this direction on the ship's glue group.
The curve data source has a very fast interval and is set to Looping so when the bullets reach their maximum distance, they loop back to the start. The A button on press simply switches on the Interval Trigger controlling the Object Position Event and Curve Data Source then on release turns it off again.

rlmergeuser
04-22-2012, 05:42 PM
Thanks for the info! Hm... Well that could maybe work for bullet shooting, but wouldn't that only allow me to have one bullet on screen at a time? I also can't see that working for enemies as I'm trying to make a more Geometry War's themed game.

rlmergeuser
04-22-2012, 08:03 PM
i'm not 100% sure how you'd animate this, but if you want lots of bullets from the same gun on screen at the same time, you could have an unseen storeroom for the bullets. your animation for the bullets would pick the next bullet in the queue, teleport it to the ship, do the bullet fired animation then, after a set amount of time, teleport back to the storeroom.

i'm not sure of the details of this, but i think you could have a counter that increases every time you press the fire bullet button. when the counter reaches the last bullet it would loop back to the first one. each bullet would need a separate bullet fired animation

rlmergeuser
04-22-2012, 09:13 PM
Yeah I was thinking of that, too. I suppose it's probably the best way. I think you would need to do that method for spawning the enemies as well. So instead of killing an enemy, it would just deactivate it and put it back in the warehouse.

rlmergeuser
04-23-2012, 03:26 AM
I got a basic version of the game up. It is called Trashcan Shooter. It's pretty basic but I figured I'd get a beta out. Feedback appreciated.

rlmergeuser
05-03-2012, 03:10 PM
hello http://forum.redlynx.com/forum/images/smilies/icon/smile.gif. I'm also interested in making a gun of some sort cant get the animation right, i cant get the bullet to fire an go back to the storage point but i cant get it to go back to the guns position and fire again, i think the problem is that i don't know how to reset my curve data source to start the animation again when i press fire. it wont let me have a trigger straight to the curve data source to start it again so i need an alternative. any suggestions?

gamer tag Andy pandy O

B0RG1OF1
05-04-2012, 12:29 AM
hi, rather than animate each "bullet" i built a delayed trigger and rejection force just like the example rejection impulse loop from the 4 player minigame example.
i put the physics bubble half way along the bullet path attached to the barrel (gamecharacter)

so now the bullets lay on the ground where they were fired until needed to fire. then they are teleported into the firing position.

you still need an object position event for each bullet and cue them in a impluse loop.

looks great and unlike the animated method has a realistic arc.

but for your needs it sounds like the animated version is the right choice.

theres a tutorial on character movement that shows a way of using a basic data source to solve that reloading problem. with it you can have several impulses working on one axis in the object position event.