Jump to content


oblivious

Member Since 09 Nov 2008
Offline Last Active Sep 13 2011 07:56 AM

Posts I've Made

In Topic: Drawing Sprites in a Circle

26 August 2011 - 02:08 PM

Wow, that worked amazingly well. Thankyou. And I ended up going with the second piece of code because unfortunately I have no grasp of for loops.

Addedly, would there be any way to find out the position of each subimage and their bounding boxes for use in collision checking?


For loops are really usefull. basicly a for loop is this
for(i=0; 1<100;1++)
{
//do stuff
}
i starts as 0.
check if i = less then 100 (it is, you initialized it as 0 so now it is zero)
do some stuff between the brackets and add 1 to i (making it 1)

i is now 1,
check if i is still less then 100 (it is, it is 1)
do some stuff again and add 1 to i again (making i 2)

This is very usefull if you use that 'i' variable in the "do stuff" part since everytime it loops trough the code i has a different number.so lets say you want to create 10 objects 15 pixels apart from aeach other you can put this in the "do stuff " part
instance_create(15*i,100,object_thing).

now every loop it will check i and create an instance of the object at 15*i.
If you want 10 objects the loop will be
for (i=1;i<=10;i++)
{
instance_create(15*i,100,object_thing)
}
it basicly does this:
instance_create(15*1,100,object_thing)
instance_create(15*2,100,object_thing)
instance_create(15*3,100,object_thing)
instance_create(15*4,100,object_thing)
instance_create(15*5,100,object_thing)
instance_create(15*6,100,object_thing)
instance_create(15*7,100,object_thing)
instance_create(15*8,100,object_thing)
instance_create(15*9,100,object_thing)
instance_create(15*10,100,object_thing)

creating 10 instances of object_thing 15 pixels from eachother. Really something to look into, just play around with it and you'll get the hang of it quite quick

In Topic: Countdown

26 August 2011 - 12:07 PM

And it works perfectly   :rolleyes:


Good to hear. If you want to know more about GML/variables and everything try looking in the help section of GM (press F1 in the program) or look under the tutorials section ehre on the forum.

In Topic: Countdown

26 August 2011 - 11:15 AM

Hey

I am starting to make a mat game.
I need a code for if I have a number=5000 and I press arrow down, then it will subtract -1.
so my plan is:
you can se 5000 on the screen and you press arrow down and then it shows 4999.

Is that possible   :rolleyes: ?

thank you

Mikkel


This is very doable but you will be needing some code. first you have to have an object which will control the counter.
In the objects create event put this:
timer = 5000

then in it's draw event put:

draw_text(x,y,real(timer)) (the X and Y you can fill in yourself, 100,100 for example)

and in the keyboard key press down event put:

timer -= 1

this should make an object with a timer of 5000 and everytime you press the down key it takes 1 off the 5000.

Then if you want it to do something special when it reaches 0 go to the objects step event and add this:

if (timer == 0){
  show_message("you reached 0")
}

Hope this helps

In Topic: Spawning

26 August 2011 - 07:19 AM

Anyone?


What exactly do you wanty from us? if you want to check if it works, make a new file in game maker.

what the code does is check if the distance to object player is more then 80 and global.light = true it creates an instance of obj_mob and otherwise it creates an instance of obj_air. the only problem is that you didn't define the x and y of where to spawn those instances

In Topic: Simple developer console issue

22 August 2011 - 06:23 PM

does this work?

room_goto(string(rom))