UrbanTerror - 2D

Talk about making games.

Re: Shooting - How is it done?

Postby Lacotemale » Sat Dec 11, 2010 3:46 pm

I gave you a +1! :) Thank you so much.
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby schnellboot » Sat Dec 11, 2010 4:02 pm

no problem ^^
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Sun Dec 12, 2010 1:46 pm

Is there any way to adjust where the bullets are coming from? It would be cool if I could get them to come from the gun! :D

Check the picture! :shock: I can't say where the bullets are coming from at the moment. :D

//Silly picture removed :D

I want to be able to adjust the position of where the bullets come from a bit.
Last edited by Lacotemale on Fri Dec 17, 2010 5:48 pm, edited 1 time in total.
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby schnellboot » Sun Dec 12, 2010 2:49 pm

Check out the code where the CreateActor function is.
There is something like Player.x,Player.y in the brackets.
Just change that to Player.x+5, Player.y+5 or something.
First do that and then you'll find out another problem.
I'll help you again then if you can't solve the problem yourself.
Good luck!
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Sun Dec 12, 2010 3:34 pm

Awesome! and I even fixed that problem so I can shoot from the gun both ways! :)

I gave you another tip for your hint! :wink:
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby schnellboot » Sun Dec 12, 2010 4:23 pm

Haha nice work and thanks!
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Mon Dec 13, 2010 2:27 pm

Hmm... I am having trouble implementing a clip system. (limit on bullets for gun)

I tried loads of different ways but none work.

As variable I have:

"clip = 15;"

Inside aimer left click I have:

"if(clip == 0)
{
PlaySound2("data/noammo.wav", 1.000000, 1, 0.000000);
}"

However it still keeps firing bullets. :?
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby lcl » Mon Dec 13, 2010 2:44 pm

You have to decrease clip every time when you shoot.
Also you have to set it so it creates bullet actor only when clip is not equal to 0.
Code: Select all
if (clip != 0)
{
    //Put the create actor code here.
    clip -= 1; //This decreases clip.
}

:D Helped? :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Mon Dec 13, 2010 3:25 pm

Yes I wasn't sure if clip should be clip-- or clip-1 but it was actually clip-= :D

As ye guys should know I do reward you with a +1 for every bit of help I get because otherwise I would be stuck for a very long time. :D

Now I have a more complicated problem... I want my player to changeanimation if the aimer is on the left or on the right of him. Can this be done in GE?

Also is there a way to show a variable on screen? Like an actor that shows the variable on it.
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby lcl » Mon Dec 13, 2010 3:48 pm

Lacotemale wrote:Yes I wasn't sure if clip should be clip-- or clip-1 but it was actually clip-= :D


clip --; Would have worked too, but I though to put clip -= 1; since it's easier to understand. :D
Lacotemale wrote:Now I have a more complicated problem... I want my player to changeanimation if the aimer is on the left or on the right of him. Can this be done in GE?

Put this code to player's draw actor script editor:
Code: Select all
if (x < aimer.x)
{
    //Put here the animation changing for facing right
}
if (x > aimer.x)
{
    //Put here the animation changing for facing left
}

Lacotemale wrote:Also is there a way to show a variable on screen? Like an actor that shows the variable on it.

If you want to show variable on screen, create some actor with text. Then you can do that:
Actor's draw actor script:
Code: Select all
sprintf(text, "%i, %d, %s", number, number2, sometext);

Where reads now %i, will be placed by integer variable called number.
%d will be placed by double named number2.
%s will be placed by string called sometext.

:D If you need help with understanding this, tell me and I'll help you. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Mon Dec 13, 2010 4:09 pm

Thanks! That aimer problem was really easy. I thought it would need alot of coding.

However the showing variable did not work at all! :(
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Tue Dec 14, 2010 11:47 am

I put this in the draw actor script:
sprintf(text, "%i", clip);


Is this correct? I want it to show the integer "clip".
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby schnellboot » Tue Dec 14, 2010 6:45 pm

no easier
Draw Actor -> Script Editor -> [show actor].textNumber = clip;
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Tue Dec 14, 2010 9:17 pm

[show actor].textNumber = clip;


What do you mean by [show actor]? What do I have to put there? :?
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: Shooting - How is it done?

Postby lcl » Tue Dec 14, 2010 10:20 pm

Lacotemale wrote:I put this in the draw actor script:
Code: Select all
sprintf(text, "%i", clip);


Is this correct? I want it to show the integer "clip".
Make sure to have the code in text actor. (Actor that has text, no animations.) :D
Otherwise your code is right. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

PreviousNext

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest