Jump to content


Scones1

Member Since 04 Apr 2012
Offline Last Active Jul 10 2012 08:02 PM

Topics I've Started

Can you help my really simple code problem?

22 June 2012 - 10:47 AM

if (instance_number(obj_Caterpillar) == 0) {
room_goto_next();  }
{show_message(Congratulations! You've passed level 1)
}                                                    

The first bit works, but when i added the message on, it is coming up that a symbol is missing? Thankyou very much

Move selected Instance towards point

21 June 2012 - 09:05 AM

Hey all! I previously wrote a topic asking for help to create a box selection method. I managed to sort it out, but now I am stuck again. I want to be able to move only the selected instances of an object to the point where I right-click. I tried something like
if (global.selected=true)
{
move_towards_point(mouse_x,mouse_y,5)
}

but that moved all instances of the object, instead of the selected ones

I am looking for something like

if (global.selected=true)
{
[i]CHOOSE ONLY THE SELECTED OBJECT AND[/i]
move_towards_point(mouse_x,mouse_y,5)
}

It is probably something really simple but thanks!



My box creation code:

Create event

boxstartx = 0
boxstarty = 0
box = false


Global left pressed event

box = true
boxstartx=mouse_x
boxstarty=mouse_y
global.selected=false


Global left released event

box = false
with(obj_Pig)
{
if(collision_rectangle(obj_controller.boxstartx,obj_controller.boxstarty,mouse_x,mouse_y,id,false,false)>=0)

{
global.selected=true
}
}


Draw event

if box = true
{
draw_set_color(c_green)
draw_rectangle(boxstartx,boxstarty,mouse_x,mouse_y,true)
}


(obj_Pig being the object I want to move)

Help with a box selection method?

13 June 2012 - 10:35 AM

Hey everybody!

Let me start by saying that I am unsure if I am posting in the right section. There used to be an individual section for Novices that I used to post into, but I cannot find it for the life of me!

I am having trouble creating a box selection method. The game I am creating(for those of you who are familiar) is a sort of Marine splitting game vs Banelings from Starcraft 2.

For those of you who have never heard of SC2, I have 2 different objects:

Exploding caterpillars that aren't controllable. They automatically crash into the pigs, killing themselves and deal AOE damage.

You have to control the multiple pigs(They are only very small) and split them up, so that they can survive for as long as possible.(They start in a big ball together, and if you don't split them they will die to the AOE damage)

Basically I want to be able to click and drag boxes to select the units, then right click to move. Is this difficult?

Thankyou very much for your help

Cant create a sprite with sprite_duplicate

09 May 2012 - 10:25 AM

Hey guys! I posted a while ago with the same problem, but I was up really late and had to go to bed(after much debate I couldn't work it out)

I am trying to go to the next room, and create an object in the next room when a button is clicked depending on the background visibility

This is what I have so far:

if background_visible[2]=true
room_goto_next()
sprite_duplicate(obj_monkey)  

It goes to the next room no problem(Which would tell me that the if statement is working fine) but I cannot for the life of me get the obj_monkey to appear on the page!

Any help would be wonderful. Thankyou very much :)

Problems with a piece of code.

03 May 2012 - 11:43 AM

FATAL ERROR in
action number 1
of Mouse Event for Left Button
for object obj_Startadventure:

COMPILATION ERROR in code action.
Error in code at line 1:
   If background_visible[2] {

at position 4: Assignment operator expected.


If background_visible[2] {
room_goto_next
instance_create(0,0,obj_Monkey);
}                                          




Hey all! I am having a problem with a piece of code.... I am unsure as to why it's not working, but I am still pretty new to this whole coding thing.

Depending on what Background is currently visible, I want to create a different animal after I have gone to the net room. The one I am starting with first is a monkey if the background is 2.

The error message is above the code I am currently using

Thankyou very much for reading, and thank you if you know what the problem is :):)