Bug In My Game

Posted by
April 16th, 2016 4:38 pm

I appear to have made an infinite loop with my spawner. If anyone knows GM:S, I could use a little help. Here is my Object Info:

Information about object: obj_spawner

Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:

execute code:

randomize()
wolf = irandom_range(1,10)

people = irandom_range(1,20)

if (!object_exists(obj_player)){
instance_create(x,y,obj_player)
}
Step Event:

execute code:

do
    {
    wolf -= 1
    were = instance_create(x,y,obj_werewolf)
    were.x = (irandom(1920))
    were.y = (irandom(1080))
    }
until (wolf =0);
do
    {
    people -= 1
    ppl = instance_create(x,y,obj_person)
    ppl.x = (irandom(1920))
    ppl.y = (irandom(1080))
    }
until (people = 0);

3 Responses to “Bug In My Game”

  1. Grahhhhh says:

    Not familiar with gms or the syntax. Was waiting to see if other people weighed in on this… Any chance you need to add a space to the until line in wolf?
    until (wolf = 0);
    Also have you checked the value of wolf once assigned? If there’s any possibility of it being 0 or lower when entering the loop, the loop is only checking for = 0, what’s the harm of changing it into =<? :)

    Good luck hope you get it!

  2. Squid says:

    I’m not sure what GM:S is but does it help if the line:
    until (people = 0);
    Is changed to:
    until (people == 0);

  3. squigglez says:

    edit: thanks to some glorious people on the IRC, the bug is fixed!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]