User Tag List

Results 1 to 5 of 5

Thread: Basic Enemy Random Movement AI

  1. #1
    No Products Registered

    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Basic Enemy Random Movement AI

    I am making a grid based RPG style game, Where there are spawners that spawn enemies as the enemies are destroyed. The enemies are supposed to move randomly up, down, left or right. The current method I use is every time they move it sets it sets their alterable value B to random(4), and the direction it moves depends on if the number is 0, 1, 2 or 3. The main problem I am encountering is that all enemies appear to have the same same value for the alterable value B, and therefore all enemies move as one. I am not sure if this is a problem with it treating all of my enemies as having the same alterable value B, or if it is because the seed is the same for all instances and therefore it gives the same number every time (those are my 2 hypotheses, it could be something else). If you know what it is and how to fix it, or a better way to do it, any help would be appreciated. This is my first time using these forums, so if there is anything I should include please tell me so that I can. Thanks in advance!

  2. #2
    Clicker Fusion 2.5iOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SolarB's Avatar
    Join Date
    Feb 2012
    Location
    Melbourne
    Posts
    904
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Hi, welcome to the forum!

    To treat each instance of the same object as a different object you'd have to use fastloops or the ForEach extension to differentiate between them. There's plenty of info on this here but here's the rundown:

    Always
    --> Spread value 0 in an alt variable (which will function as an ID)

    Always
    --> start loop "whatever"

    On Loop "whatever"
    alt. variable (ID) of object = loopindex ("whatever")
    --> set variable B to random(4)

  3. #3
    No Products Registered

    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, I tried to do that, but I'm getting the same result as before. I have never used loops before (I just started MMF this year, and don't have much experience). I assumed that that the first line was the condition, and the lines below were the events. What I did was:

    Always
    (special conditions) Start loop "Randamove" 1 times
    (enemyrat) Spread Value 0 in Alterable Value Z

    On Loop "Randamove"
    (special conditions) Set loop "Randamove" index to Alterable Value Z("enemyrat")
    (enemyrat) Set Alterable Value B to Randome(4)

    If I did something wrong or used the wrong command I would be grateful if someone could point that out, also, any other suggestions are welcome as well.
    Thanks!

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont see what the problem is, and i dont think you need to use loops.
    Attached files Attached files

  5. #5
    No Products Registered

    Join Date
    May 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, I know whats going on! I was activating and deactivating event groups, which happened according to only the first enemy, thanks to everyone who helped, hopefully now I can get it working.

Similar Threads

  1. Platform movement on Active objects using Nifflas' basic movement widget
    By ac3raven in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th October 2012, 02:16 AM
  2. Basic Enemy Spaceship side shooter AI example
    By 300happy in forum File Archive
    Replies: 1
    Last Post: 20th August 2012, 08:47 PM
  3. help on enemy movement
    By Pixzel in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th February 2011, 09:30 PM
  4. fastloops for basic enemy controll (platformer)
    By BrashMonkey in forum File Archive
    Replies: 39
    Last Post: 26th July 2010, 05:59 PM
  5. May have been misplaced: Random Platform Enemy AI?
    By jayklik in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 18th April 2007, 04:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •