Help Please

Non-platform specific questions.

Help Please

Postby QuasarCreator » Mon Sep 05, 2011 12:57 am

Right now I am making an app in my free time. :o However, I am completely new with all this. So if someone could please help me with my question I would be very thankful. :D

In my game their will be a spaceship that launches a rocket. So, how can I make it so whenever the user double taps the screen the rocket will fire in the direction of the tap? :?:
QuasarCreator
 
Posts: 5
Joined: Sun Sep 04, 2011 1:38 am
Score: 0 Give a positive score

Re: Help Please

Postby skydereign » Mon Sep 05, 2011 1:10 am

Here's a pretty simple way of doing it. Have a filled region stretch across the screen. Then add this for its mouse button down event (you need to add an int variable called timer).
click_region -> Mouse Button Down (left) -> Script Editor
Code: Select all
timer=10;
if(timer>0)
{
    CreateActor("rocket", "rocket_anim", "(none)", "(none)", player.x, player.y, true);
}

Then in the actor's draw, have this.
click_region -> Draw Actor -> Script Editor
Code: Select all
timer-=timer>0;


Now to make the rocket actually move toward the mouse position, put this in the rocket's create actor event.
rocket -> Create Actor -> Script Editor
Code: Select all
directional_velocity=20;
angle=direction(xscreen, xmouse, yscreen, ymouse);
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Help Please

Postby QuasarCreator » Mon Sep 05, 2011 4:21 am

Ok thanks!
QuasarCreator
 
Posts: 5
Joined: Sun Sep 04, 2011 1:38 am
Score: 0 Give a positive score

Re: Help Please

Postby QuasarCreator » Mon Sep 05, 2011 4:40 pm

I have a problem right now. When I type in the code it says it can not define the variable. What should I do?
QuasarCreator
 
Posts: 5
Joined: Sun Sep 04, 2011 1:38 am
Score: 0 Give a positive score

Re: Help Please

Postby Jagmaster » Mon Sep 05, 2011 9:34 pm

You will need to declare a variable called timer. Here is a tutorial for that (from the tutorial page) http://game-editor.com/forum/viewtopic.php?f=4&t=8603&start=0
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest