How would you make a 'attack' for my main character?

Talk about making games.

How would you make a 'attack' for my main character?

Postby lilmuleman214 » Fri Aug 03, 2007 5:34 pm

How would you make a 'attack' for my main character, that destroys other actors.
Like how would you make a gun? Or a sword that would be able to kill a 'monster'?
Life is to good to waste
Go To http://www.Game-junkiez.us
to play/download my games.
User avatar
lilmuleman214
 
Posts: 102
Joined: Wed Jul 25, 2007 6:42 pm
Score: 5 Give a positive score

Postby NUTINC » Fri Aug 03, 2007 6:18 pm

To make a gun all you would need to do is make a gun drawing on your character and then make the bullets, the bullets need to have a different version for each direction. You simply change the x and y velocities so they go at the speed and directions you want. When you press the shoot button, have it create the bullet actor for the direction you want and HUZZAH!... oh and make sure the bullets have a collision event with each enemy.

To make a sword (which is kinda tricky) you will have to make 2 animations, one showing the character swinging the sword, and a second showing the sword swing finished (2nd must be single frame), put an animation finish event on the first anim to change it to the 2nd anim and create an actor where the sword is in the animation (like the bullet, except invisible and stationary) make sure the actor damages the enemy, and destroys itself almost instantly, and change the players anim back to normal, and you're done. Any questions :?:
To those of you out there, I am not dead. I am a ghost! There is a difference!
Currently Working on: Parts, A self-assembling adventure
User avatar
NUTINC
 
Posts: 98
Joined: Fri Feb 09, 2007 1:06 am
Location: Lost in the deep dark recesses of my mind, wondering why the exit sign leads to brick wall
Score: 6 Give a positive score

Postby saabian » Fri Aug 03, 2007 6:20 pm

Well. The "enemy" actor will get hurt or destroyed first when it collide with another actor. So wile creating a animation for your actor paint a gun in his hand. create also a small animation (and an actor using it) that looks lika a small bullet, name that actor "bullet".
In the actor event for your mainactor, press the event button, chose key down, chose key "ctrl" press add event (?) chose create actor, chose your bullet actor.

In game mode once you press ctrl the bullet will be created. more info about how to set a speed for the bullet and were it to fly can be found in the forum.
If you want a sword, create a separate swordactor and make its parent (button in event window) the playeractor, just put the sword in the playeractors hands it it will stay there will player actor are moving.

In the enemy actorevent meny chose "collide" and "destroy actor" if it collides with the sword actor.

More specific info about this can be found in tthe forum.
User avatar
saabian
 
Posts: 25
Joined: Sat Dec 09, 2006 1:27 pm
Location: Gothenburg => Sweden
Score: 0 Give a positive score

Postby Zehper48 » Sun Aug 05, 2007 8:36 pm

if you dont feel like making a new bullet for each direction just make 1 bullet and put this code for create actor
Code: Select all
if (lastdirection ==1)
{
yvelocity-=15;
}
if (lastdirection ==2)
{
xvelocity-=15;
}
if (lastdirection ==3)
{
yvelocity+=15;
}
if (lastdirection ==4)
{
xvelocity+=15;
}

then make a variable called lastdirection then make 4 key down events for up make it
Code: Select all
lastdirection=1;
then for right do
Code: Select all
lastdirection=2;

then for down do
Code: Select all
lastdirection=3;
for left do
Code: Select all
lastdirection=4;

i hope this helped
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score

Postby DilloDude » Sun Aug 05, 2007 11:22 pm

Zehper48 wrote:
Code: Select all
if (lastdirection ==1)
{
yvelocity-=15;
}
if (lastdirection ==2)
{
xvelocity-=15;
}
if (lastdirection ==3)
{
yvelocity+=15;
}
if (lastdirection ==4)
{
xvelocity+=15;
}

a more efficient form of this code would be
Code: Select all
switch (lastdirection)
{
    case 1: yvelocity -= 15; break;
    case 2: xvelocity -= 15; break;
    case 3: yvelocity += 15; break;
    case 4: xvelocity += 15; break;
}
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby lilmuleman214 » Mon Aug 06, 2007 12:38 am

ok, thanks!
Life is to good to waste
Go To http://www.Game-junkiez.us
to play/download my games.
User avatar
lilmuleman214
 
Posts: 102
Joined: Wed Jul 25, 2007 6:42 pm
Score: 5 Give a positive score

Postby lilmuleman214 » Mon Aug 06, 2007 2:43 pm

whats a variable?
Life is to good to waste
Go To http://www.Game-junkiez.us
to play/download my games.
User avatar
lilmuleman214
 
Posts: 102
Joined: Wed Jul 25, 2007 6:42 pm
Score: 5 Give a positive score

Postby pixelpoop » Mon Aug 06, 2007 2:57 pm

In the script editor window there is a button called Variables. This brings up the User Variables window. From here you can add, remove and change variable properties.

A variable holds different information.
An Integer variable holds only whole numbers, not decimal places.
a Real variable holds decimals and/or very large whole numbers.
a String holds a series or string of information.

a variable can be Global or Local.
-Local Variable means it is actor specific. If actorA sets Local Integer lastdirection to equal 1, actorB's lastdirection does not change.
-Global means their is one instance of the variable and if one code changes it, it changes for every other code accessing it.

In the math equation 5-x=3, x is a variable.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby lilmuleman214 » Mon Aug 06, 2007 3:31 pm

ok, so how would I make a variable?
Life is to good to waste
Go To http://www.Game-junkiez.us
to play/download my games.
User avatar
lilmuleman214
 
Posts: 102
Joined: Wed Jul 25, 2007 6:42 pm
Score: 5 Give a positive score

Postby d-soldier » Mon Aug 06, 2007 3:35 pm

Click up on "SCRIPT", then select "GLOBAL CODE", then move down and select the button that says "VARIABLES", click "ADD" enter the new variable's name in the box, change 'global' to 'actor' if needed, and click "ADD" again. "close"/"close". Your done.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby lilmuleman214 » Mon Aug 06, 2007 5:14 pm

For the last direction variable, what kind of variable is it?
Also where do I put the key down events? in the bullet, or my main character?
Life is to good to waste
Go To http://www.Game-junkiez.us
to play/download my games.
User avatar
lilmuleman214
 
Posts: 102
Joined: Wed Jul 25, 2007 6:42 pm
Score: 5 Give a positive score

Postby d-soldier » Tue Aug 07, 2007 2:05 am

That example would be fine as a global, since you are only controlling the movement of your player. The keydown event would be an event of your player (since the bullet actor would not be created yet it can't have keydown events). And that keydown event would only be to "create" the bullet. The scripts posted above would be in the bullet's "create-actor" event.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron