Message Board


Message Board > Fenix / Bennu / Gemix / DIV > Help w/Fenix character movement

March 22, 2010, 17:22
Donna
Beardless
4 posts
I tried Fenix a while back, gave up, then started again last month. Found the Fenix on Fire site with some examples, flipped through the Fenix manual, but I'm stuck again on what is probably a really easy thing to do. I have a character (right now called enemy1). I also have a character (right now called hero). I have the hero setup so you can move him/her with keyboard keys. No problem.

How do I randomize the movement of enemy1? I want the enemy to be able to move freely about the screen until it runs into the hero (I have collision detection setup). Help, please?
____________
#
March 23, 2010, 09:44
Eckolin
Quite Whiskered
388 posts

Here's a simple suggestion.

Code:

advance(5);
// Insert level collision detection around here.

if (turntimer--<=0)
// Randomly picks one of the four cardinal directions. 
// This can be adapted to free rotation or to disallow the same angle to be drawn twice in a row.
    angle=rand(0,3)*90000; 
// Next rotation in 25 to 100 frames.
    turntimer=rand(25,100); 
end


Where turntimer is a private variable of enemy1

If your code uses graphics that shouldn't rotate, you can introduce your own variable that stores the current direction and use, for instance, xadvance().

For more detailed help I'll need more detailed information.
____________
Maker of Games...
Wisdom is supreme; therefore get wisdom.
Need help with coding? I probably wrote something similar.
#
March 28, 2010, 19:07
Donna
Beardless
4 posts
Thanks Eckolin! I'll give it a try.
____________
#
April 5, 2010, 02:54
Mezzmer
Square-theorist
792 posts

Ok. Any other questions you can direct to me.

I have lots of spare time.

ASL?
____________
#
April 6, 2010, 15:20
Sandman
F3n!x0r
1194 posts

Square's next purchase:

____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
April 10, 2010, 13:51
Mezzmer
Square-theorist
792 posts

Because i am a sugar daddy?
____________
#
April 11, 2010, 13:21
Sandman
F3n!x0r
1194 posts

Maybe.
____________
BennuWiki
Yes, my avatar has grey borders in IE (so get a decent browser)
ROOFLEZ ROOFLEZ
#
April 12, 2010, 23:03
Donna
Beardless
4 posts
ASL? American Sign Language? I know a little.

Love the van!

I will post any other Fenix-related questions for you since you have a lot of spare time!!
____________
#
September 23, 2010, 13:45
Dennis
どこかにいる
2092 posts

Here is an idea for a "chasing" enemy, followed on Eckolin's principle. It will move in the player's direction (but only in 4 directions)

Fenix code:

advance(5);
// Insert level collision detection around here.

if (turntimer--<=0)
    player_id = get_id(type player);  
    if (player_id != 0)
      new_angle = (get_angle(player_id)/90000)*90000;
    else
      new_angle = rand(0,3)*90000;
    end
    angle=new_angle;
    turntimer=rand(25,100);
end

____________
Kwakkel
#
March 1, 2011, 22:05
Zosma
Senior Procrastinator
99 posts

ASL = Age, Sex, Location. It's typically used by MSN whores like Square. Anyway, I hope you have sorted your code out!
____________
Fuck a duck
#

Message Board > Fenix / Bennu / Gemix / DIV > Help w/Fenix character movement

Quick reply


You must log in or register to post.
Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!