Bullet direction and checkpoint system

Non-platform specific questions.

Bullet direction and checkpoint system

Postby Pyathus » Mon Jun 27, 2011 4:57 pm

Hey guys so I'm trying to make it so if I am turned right, the bullet will go xvelocity++25; and if im turned left, xvelocty=-25; so I put

Code: Select all
if (bulletdir==1)
{
    xvelocity=+25;
}
else if (bulletdir==0)
{
    xvelocity=-25;
}

in my draw actor script of my bullet, and it seemed to work but if I shot a bullet right, then turned left, the bullet would turn left in mid air... and also, the bullets that I shoot left, I cant seem to position them in front of the gun since I already positioned them in front of the gun turning right. so they shoot from the same point which looks off.

and now about my checkpoint system:
my checkpoint is working, but I cant seem to get the view to continue to follow the character and be placed exactly where it was in front of the player after I get respawned at a checkpoint. and my view also stops parenting the player, or vice versa. any way that I can position my view back where it was in front of the player and continue to parent him? and if anyone has a better way to get the view to move with my character a little better without parenting, Id really appreciate it. :)
Pyathus
 
Posts: 12
Joined: Mon Jun 13, 2011 2:59 am
Score: 0 Give a positive score

Re: Bullet direction and checkpoint system

Postby jimmynewguy » Mon Jun 27, 2011 5:49 pm

for the bullet put your script in create actor instead of draw actor

for the view try this on the player draw actor
Code: Select all
view.x = x - 160;//change 160 to half the views width
view.y = y - 120;//change 120 to half the views height

and see how that works for you
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Bullet direction and checkpoint system

Postby foleyjo » Mon Jun 27, 2011 9:10 pm

For the left right thing what about having an actor variable called gunposx.

When your character turns the gunposx value changes then in the create actor for the bullet put the X value as gunposx .

Or you could have the bullets zdepth below the player so no matter where the bullet comes from you don't see it until it has left the gun barrel. Though this only works if the player sprite hides the bullet till it comes out.


You could also change your bulletdir to = 1 and -1 then in the code for the bullet instead of having 2 ifs you could simply use

xvelocity = 25*bulletdir;
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest