Posted By
|
Message
|
 Benjamin
Registered 29/05/2005
Points 110
|
3rd June, 2005 at 11:42:34 -
Hi
I'm currently doing a Vertical Shoot em up, and have a sub-boss that's moving left and right, according to the
players movement. So if the player's X value is Lower than X value of Boss -> Set X position of Boss to Pos of Boss - 1 and the equivalent counterpart for the opposit direction. Now, My problem is, that I would like to have 2 of them, Sometimes it seems to work when 2 are on screen, but eventualy 1 (the one that spawned 2.) will drift into no where ( preferable to the right). Now I guess something could be done by giving both of the Objects an unique ID via an Variable , But how would I do that, and how can I use it for this specific situation?...
And another question... Huw can I get objects to move in Sin/cos - curves?
thanks in advance
n/a
|
 Cazra Crazy?
Registered 24/07/2002
Points 4472

|
3rd June, 2005 at 11:52:34 -
For the bosses and giving them a unique ID, spread value 0 in one of their alterable values. The first boss objects alt value will equal 0 and the other will equal 1. Even with these values assigned though, MMF/TGF will still be weird about it. Here's how I would make something like this work right:
>always
-spread value 0 in alt. value of boss
>if value of boss=0
-set value A of boss companion(separate object that can't be seen. Used for storing boss data) to X("boss")
>if value of boss=0
+>if value A of boss companion < X("player")
-set boss X to X("boss")+1
>if value of boss=0
+>if value A of boss companion > X("player")
-set boss X to X("boss")-1
>if value of boss=1
-set value A of boss companion(separate object that can't be seen. Used for storing boss data) to X("boss")
>if value of boss=1
+>if value A of boss companion < X("player")
-set boss X to X("boss")+1
>if value of boss=1
+>if value A of boss companion > X("player")
-set boss X to X("boss")-1
As for sin/cos curves, do you mean in circular movements?
n/a
|
 Knudde (Shab) Administrator
Crazy?
Registered 31/01/2003
Points 5125
     
|
3rd June, 2005 at 13:43:51 -
Snerlin's way works, cause he's programming for every instance of the boss. You could do the same in less code using fastloops as well. You can find a variety of articles on it if you use the "search DC" link that's in your user panel
Craps, I'm an old man!
|
 AndyUK Mascot Maniac
Registered 01/08/2002
Points 14586
  
|
3rd June, 2005 at 17:48:04 -
sin and cos curves?, that would be the advanced maths object for The games factory, Mmf has all that extra mathematical stuff built in.
.
|
 Benjamin
Registered 29/05/2005
Points 110
|
4th June, 2005 at 12:21:50 -
I fixed the boss movement, did it with a completely different methode though. I used an active object that's always relative to the players X cordinate, and used ball movement on the bosses and the direction calculator to rotate them to that helper object. Works pretty well, also works without any problems with 3+ enemies.
about the sin cos movement, I mean in a wavy motion, not circling around another object. Pretty much all classic Shmups I know had some enemies that had a sin cos curve movement. I know that It can be done, my only problem is, that I'm not good with math, so a little help would realy be apreciated.
n/a
|
 Cazra Crazy?
Registered 24/07/2002
Points 4472

|
4th June, 2005 at 12:36:29 -
if you're just making their movement wavy going left and right, you can do the following:
// make the enemy move left and right using a flag
>If flag of boss is off
-set X("boss") to X("boss")+1
>If flag of boss is on
-set X("boss") to X("boss")-1
>If X("boss")< (whatever is the furthest left you want the boss to go)
-set flag of boss to off
>If X("boss")> (whatever is the furthest right you want the boss to go)
-set flag of boss to on
//wavy motion( up and down )
>always set Y("boss") to ( whatever the normal Y coordinate of the boss is )+((amplitude of wave movement)* sin( altvalue2("boss")))
-add X to altvalue2 of boss
For certain parts, you can replace the text with whatever value you want.
n/a
|
|
|