trails/creating actors through script

Game Editor comments and discussion.

trails/creating actors through script

Postby beefwelington » Tue Jul 25, 2006 7:59 pm

I'm working on a visually simplistic game as a first game. My main "character" is a simple red dot, tiny enough to basically look like a pixel. I've worked out a control scheme to control the dot's movement by using the xvelocity and yvelocity variables.

What I'm trying to do is add a little spice to the mix. I'm trying to trace the path of my flying dot using clones of the dot itself. Kind of like the game snake, where you control the head but the "body" remains. I haven't decided if I want the body to eventually dissapear and give the illusion of having a definite length, like snake, or if I want the body to remain for the duration of the game, like tron.

The trail on the dot can't be straight lines, because the dot moves in a curvy way rather than along the x and y paths. It's got to be identical dots that simply mark where the dot was a moment ago, and remain on that spot.

So I was thinking I'd just create actors in the path of the main actor I'm controlling, and have the animation be the same image I'm using for my character. Trouble is, I don't know how to spawn actors during runtime as opposed to just creating them in the editor. Any help?
beefwelington
 
Posts: 13
Joined: Wed Jul 19, 2006 9:47 pm
Score: 0 Give a positive score

Postby nappie » Tue Jul 25, 2006 8:13 pm

i dont know excactly anymore.. it has been a year ago i last did GE
just started again.. but something with a timer and create actor should work

-create timer
-create actor every ... second
-x = head.x
-y = head.y

maybe someone should lighten it up :shock:
__

i really like the idea. i always hate snake because you stop if youve collected a certain amount of coins.. try to live the max amount of time is more my thing :P maybe that that is an idea for an game mode ;)
nappie
 
Posts: 15
Joined: Sun Jul 23, 2006 9:10 pm
Score: 0 Give a positive score

Postby beefwelington » Tue Jul 25, 2006 8:25 pm

Thanks for the help. What you've said makes sense, but I still need help in terms of the syntax. I don't know the actual code to create/destroy actors and place them. I was reading another thread and it gave me the idea to use transparency and simply move the actors into place before making them visible, then making them invisible once they've been there for a second or two.

As far as the game goes, I'm not going for a snake clone, and It won't matter if you run over your own tail, but it would add a lot to the game in terms of eye candy, and it would also help a lot to determine which way the character is headed, since it's already so durn tiny. Having an "endless" mode where you just can't hit your own tail is a cool idea though. Who knows? :D

So I kind of get the process, but I still need to know the actual language used in this kind of task. Most importantly, creating actors through script.
beefwelington
 
Posts: 13
Joined: Wed Jul 19, 2006 9:47 pm
Score: 0 Give a positive score

Postby makslane » Tue Jul 25, 2006 8:53 pm

You can create your actors in the script using the CreateActor function (http://game-editor.com/docs/script_refe ... reateactor).
You can use the 'variables/functions' button, select the CreateActor function and a panel will open to help you.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby beefwelington » Tue Jul 25, 2006 9:39 pm

Okay, I've basically got a timer that creates a copy (not a clone) of my main actor in the same location as the actor every 12 ms. Then there's a createActor event on that copied actor that destroys itself 500ms later.

For the moment, I've got what I want, but the 12 ms minimum on the timer means that there are holes inbetween the trail actors. I guess it'll do, or maybe later I'll have to make the actor larger so there's no gap, but I wonder why there's a 12ms limit on timers.
beefwelington
 
Posts: 13
Joined: Wed Jul 19, 2006 9:47 pm
Score: 0 Give a positive score

Postby makslane » Tue Jul 25, 2006 9:48 pm

In this case, it's better create in the 'Draw Actor' event, if the current actors position is different from previous position.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron