UrbanTerror - 2D

Talk about making games.

Re: Shooting - How is it done?

Postby Lacotemale » Wed Dec 15, 2010 11:41 am

Here is where I put it: (actor)ammoCount >> Draw Actor >> Set Text. However it just shows that text.. not the variable.

//Another silly picture removed :D
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 skydereign » Wed Dec 15, 2010 11:54 am

Don't use Set Text. Use Script Editor. sprintf is a function, so you have to use it in script. Generally it is better not to use Set Text, as you have the string functions, like sprintf.

ammoCount -> Draw Actor -> Script Editor
Code: Select all
sprintf(text, "%i", clip);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Wed Dec 15, 2010 12:25 pm

I already tried putting in script here:

ammoCount -> Draw Actor -> Script Editor

This is what shows up:
:|

//Yet another silly picture removed :lol:
Last edited by Lacotemale on Fri Dec 17, 2010 5:49 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 » Wed Dec 15, 2010 12:28 pm

Lacotemale wrote:
[show actor].textNumber = clip;


What do you mean by [show actor]? What do I have to put there? :?

actor showing the amount of the 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 skydereign » Wed Dec 15, 2010 12:32 pm

That is because you did not make the actor a text actor. For any of this to work, you'll need to add some default text to the text actor. Since Set Text has already worked for you, that means you have inputed a text file. Now what you need to do is insert a 0 in the default text zone. So on the actor control panel, click text. This is where you added your .ttf file, in the big box, put the zero, and your actor is officially a text actor.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Shooting - How is it done?

Postby Lacotemale » Wed Dec 15, 2010 2:57 pm

LOL after putting 0 in the text it works! :D I wish somebody told me sooner. Thanks!! :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 Lacotemale » Wed Dec 15, 2010 6:59 pm

Hmm... why does changeAnimation not work inside my script located here?:

aimer >> Left mouse down >> script.

Any changeAnimation code does nothing in the script. Anything wrong with this??

if(weapon <1 && right==1)
{
ChangeAnimation("Player", "stab-right", FORWARD);
}

else
ChangeAnimation("Player", "stab-left", FORWARD);


Also can more than one statement be given to else? Like shown below:

else
{
PlaySound2("data/noammo.wav", 1.000000, 1, 0.000000);
ChangeAnimation("Player", "beretta-empty-left", FORWARD);
}


The sound plays but it does not change the animation.

Any more help with these things would be great! :)
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 skydereign » Thu Dec 16, 2010 1:47 am

There shouldn't be any problems with ChangeAnimation. The only things that cause the actor not to change animation, is spelling either the actor's name, or animation name wrong. Are you sure it is "stab-right"? Also yes, more than one statement can be used in else. You can also use else if().
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: URT - 2D

Postby Lacotemale » Thu Dec 16, 2010 1:33 pm

The file names are correct and this is all im trying to get working:

if(weapon ==0 && right==1 && left==0)
{
ChangeAnimation("Player", "stab-right", FORWARD);
}

if(weapon ==0 && left==1 && right==0)
{
ChangeAnimation("Player", "stab-left", FORWARD);
}



Ive no idea why it won't work... anyone wanna help? I can post up full code if someone is will to help me out.
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: URT - 2D

Postby schnellboot » Thu Dec 16, 2010 4:34 pm

is the code in Draw Actor?
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: URT - 2D

Postby Lacotemale » Thu Dec 16, 2010 7:25 pm

No the code is in: mouse click left

This is because I want to stab if the mouse is clicked and the weapon == 0 (knife).
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: URT - 2D

Postby Lacotemale » Fri Dec 17, 2010 3:42 pm

Any help with my current issues (mostly with ChangeAnimation) would be great! Please check the issues and check the source code (on first page) to see what the hell im doing wrong! (its probably something stupid and easy to fix) :D

Then you get a nice +1 for each issue fixed! :wink:
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: URT - 2D

Postby schnellboot » Fri Dec 17, 2010 9:26 pm

This solves both ChangeAnimation issues.
The problem was in Player -> Draw Actor.
If you need more help just tell me.

note: new variable "stab"
Attachments
URT-2D.zip
(289.26 KiB) Downloaded 123 times
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: URT - 2D

Postby Lacotemale » Sat Dec 18, 2010 7:59 pm

Thank you so much Schnellboot! For being so helpful and cool I gave you a +1... it wouldn't allow me to give you your second one but you will get it soon! :wink:

I had an idea it was to do with the Player >> Draw actor but I just didn't know how to sort it. :D

My gun empty looks quite nice but my stab animation is... so bad! :oops: Ah well im a programmer so I can't expect to be good at graphics. :D
User avatar
Lacotemale
 
Posts: 285
Joined: Wed Dec 08, 2010 7:47 pm
Location: /home
Score: 7 Give a positive score

Re: URT - 2D

Postby schnellboot » Sat Dec 18, 2010 8:33 pm

Thanks!
I uploaded a new one.
There are all player sprites in 76*100
Check it out!
Attachments
URT-2D.zip
(287.92 KiB) Downloaded 114 times
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

PreviousNext

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest