Array programming

Talk about making games.

Array programming

Postby VYTIS_KNIGHT » Wed Jul 21, 2004 2:08 pm

Can this be done in Game Editor?

Setup an array move all the Aliens left or right or up or down together. Then, do a distance check to see how close you are to the top, left, right and bottom bounds. If they are too close, move the opposite direction or down.
VYTIS KNIGHT
VYTIS_KNIGHT
 
Posts: 29
Joined: Tue Jun 15, 2004 2:33 am
Score: 0 Give a positive score

Postby jazz_e_bob » Wed Jul 21, 2004 3:28 pm

Yes. :)

(Your description is a solid basis for the code itself.)

The following PseudoCode outlines a possible solution...



Variables:

global_Invaders_Direction
global_Invaders_Speed

invadersWin


Routines:

init_Invaders
{
invadersWin = FALSE
global_Invaders_Direction = RIGHT
global_Invaders_Speed = SLOWEST

( create invaders in start up position here )

}


On Draw Invader
{
myDirection = global_Invaders_Direction
mySpeed = global_Invaders_Speed

If too close to right ( eg x > max )
drop global level and change global direction
else If too close to left (eg x < min )
drop global level and change global direction
if global level is ground level ( eg y > max )
invadersWin = TRUE

adjust global_Invaders_Speed according to population of invaders

}


I hope this helps! 8)
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Thu Jul 22, 2004 1:38 pm

You can make this too:

- Create a Wire Frame actor (actor Base)
- Create your alliens and make the Base actor your parent
- to move all alliens, just move the Base actor
- Create other four Wire Frame actors (will be our sensor actors: sensor_left, sensor_right, sensor_top, sensor bottom)
- Put one at right side of view, other on left, other on top, other on bottom

Now, in your Base actor:

- When collides with sensor_left, xvelocity = 1
- When collides with sensor_right, xvelocity = -1
- When collides with sensor_top, yvelocity = 1
- When collides with sensor_bottom, yvelocity = -1
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby VYTIS_KNIGHT » Wed Jul 28, 2004 5:53 pm

makslane, Do you have an example of this?
VYTIS KNIGHT
VYTIS_KNIGHT
 
Posts: 29
Joined: Tue Jun 15, 2004 2:33 am
Score: 0 Give a positive score

Postby makslane » Thu Jul 29, 2004 12:26 pm

I will make a tutorial soon
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby VYTIS_KNIGHT » Thu Jul 29, 2004 12:30 pm

What happens to the children of the parent dies? Say you have parent 1 and child1, child2, and child3 is connected to it.
VYTIS KNIGHT
VYTIS_KNIGHT
 
Posts: 29
Joined: Tue Jun 15, 2004 2:33 am
Score: 0 Give a positive score

Postby makslane » Thu Jul 29, 2004 8:37 pm

When the parent dies, the child stay live
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby VYTIS_KNIGHT » Thu Jul 29, 2004 8:44 pm

Does it follow the same path or directions the parrent was programmed to do?
VYTIS KNIGHT
VYTIS_KNIGHT
 
Posts: 29
Joined: Tue Jun 15, 2004 2:33 am
Score: 0 Give a positive score

Postby makslane » Fri Jul 30, 2004 10:53 pm

Yes, All children moves will be relative to parent
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby VYTIS_KNIGHT » Fri Jul 30, 2004 11:06 pm

So if the parent dies and the parent was set to move a certain direction, the children associated with the parent still move in the direction the parent was programmed to move. Is this correct?
VYTIS KNIGHT
VYTIS_KNIGHT
 
Posts: 29
Joined: Tue Jun 15, 2004 2:33 am
Score: 0 Give a positive score

Postby makslane » Sun Aug 01, 2004 2:01 am

If a parent die, your children has no more parents.
So, will stop

To see the Space Invaders tutorial, please
update your Game Editor to 1.2.2 version,
updaate your tutorials (Help -> Get Newest Tutorials),
and go to Help -> Demo Making Of -> Space Invaders
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron