Jump to content


Photo

Code Timing


  • Please log in to reply
5 replies to this topic

#1 borgisme5

borgisme5

    GMC Member

  • New Member
  • 10 posts

Posted 26 February 2009 - 08:40 PM

A Breakout style game

object_ball = default ball
object_ball_super = ball that goes through bricks
(object_ball_super is a child of object_ball)

Issue itself matters when the multiball pick up is picked up while there is already one in play. There can only be one kind of ball in play, either the default kind, or the power kind.

I have it so that you can have up to 27 balls in play at once, because I think it's cool.
Basically, I need it so that the first group of code does not happen if their are object_ball_super in play. Otherwise, if I have several object_ball_super in play, it will make regular balls instead of more superballs.


(This is for when the the paddle collides with the powerup icon that descends from above.)
[codebox]
with (object_ball)
{
var nnn;
repeat (2)
    {
    nnn=instance_create(x,y,object_ball_random);
    nnn.direction=random(360);
    nnn.speed=10;
    nnn.oldspeed=10;
    }
}

with (object_ball_super)
{
var nnn;
repeat (2)
    {
    nnn=instance_create(x,y,object_ball_super);
    nnn.direction=random(360);
    nnn.speed=10;
    nnn.oldspeed=10;
    }
[/codebox]

Edited by borgisme5, 26 February 2009 - 08:58 PM.

  • 0

#2 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3278 posts
  • Version:GM8.1

Posted 26 February 2009 - 08:59 PM

im not sure what your trying to do. plz tell us what you want us to figure out. i don't see any question marks in your OP. i simplified your code a little.
with (object_ball)
{
	repeat (2)
	{
		with(instance_create(x,y,object_ball_random))
		{
			direction=random(360);
			speed=10;
			oldspeed=10;
		}
	}
}
	
with (object_ball_super)
{
	repeat (2)
	{
		with(instance_create(x,y,object_ball_super))
		{
			direction=random(360);
			speed=10;
			oldspeed=10;
		}
	}
}

  • 0

#3 borgisme5

borgisme5

    GMC Member

  • New Member
  • 10 posts

Posted 26 February 2009 - 09:02 PM

"Basically, I need it so that the first group of code does not happen if their are object_ball_super in play. Otherwise, if I have several object_ball_super in play, it will make regular balls instead of more superballs."
  • 0

#4 slayer 64

slayer 64

    GMC Member

  • GMC Member
  • 3278 posts
  • Version:GM8.1

Posted 26 February 2009 - 09:12 PM

so...if there are any regular balls make more regular balls. but if there aren't any make super balls? something like...
with (object_ball)
{
	repeat (2)
	{
		with(instance_create(x,y,object_ball_random))
		{
			direction=random(360);
			speed=10;
			oldspeed=10;
		}
	}
}

if !instance_exists(object_ball)
{
	with (object_ball_super)
	{
		repeat (2)
		{
			with(instance_create(x,y,object_ball_super))
			{
				direction=random(360);
				speed=10;
				oldspeed=10;
			}
		}
	}
}

  • 0

#5 borgisme5

borgisme5

    GMC Member

  • New Member
  • 10 posts

Posted 26 February 2009 - 09:45 PM

If the balls that are in play are regular balls, have each ball in play create two more regular balls.
If the balls that are in play are super balls, have each super ball in play create two more super balls.

That's an easier way to put it.
  • 0

#6 borgisme5

borgisme5

    GMC Member

  • New Member
  • 10 posts

Posted 26 February 2009 - 09:54 PM

Whoops, double post =(

Edited by borgisme5, 26 February 2009 - 09:54 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users