www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/20/10:16:27

From: vinhk AT _nospammer_hotmail DOT com (VinN)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Q:Implement of enemy's moves
Date: Fri, 20 Mar 1998 09:20:37 GMT
Message-ID: <3512330d.5313605@news.hknet.com>
References: <75962f0d DOT 35103ad7 AT aol DOT com>
MIME-Version: 1.0
NNTP-Posting-Host: 202.67.237.136
Lines: 54
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Wed, 18 Mar 1998 16:21:21 EST, ChrHenz <ChrHenz AT aol DOT com> wrote:
>
>I guess the question is how to implement certain movement-patterns...
>
>Just an idea... (i haven't tried it and don't know if it is a reasonable way
>to do it)
>
>Perhaps you could create an array of 'modifiers' for the coordinates of your
>alien spaceships (or whatever).
>(Each array would then define a certain movement-pattern)
>
>int PosModifiers[2][MAX_LENGHT];
>
>Here you could then store values that you would like to add to your X/Y-
>Coordinates...
>
>In your loop to update the enemy positions you could then have something like
>this:
>
>EnemyShip.X+=PosModifiers[0][EnemyShip.ModifierIndex];
>EnemyShip.Y+=PosModifiers[1][EnemyShip.ModifierIndex];
>
>For example, if your ship should move straight down, the array would look
>like:
> 0/1
> 0/1
> 0/1 etc...
>
>or straight up:
> 0/-1
> 0/-1
> 0/-1 etc...
>
>Using a method like this you could easily alternate moving speed (still
>straight down).
> 0/1
> 0/2
> 0/3 etc for an acceleration...
>
>Any comments ?
>
>Christian.

 Hi,
	I've already try something like move_pattern[] & store the
 	define directions(like U=0, UL=1,L=2...R=6,UR=7.)
	And the enemy have it's own move_pattern[], and my
	main loop call the routine once for update the enemy's
	direction & it's moves. But, the result is not good (I think).
	
	Did U guys have some example(s)/comment(s) for that ?

VinN.
sorry about my poor english.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019