Cant get frame to change

00george

  • Posts: 161
Hi I have a behaviour that someone helped me make. That basicily draws a rectangle to the users size and draws a region inside that rectangle. Then if you draw the rectangle over the soldiers it should set the selected attribute to true and then change the soldiers frame. But for some reason it will not. I used the drawing to check if selected is true but it is not. I have also enabled debug drawing to see if the region if in the rectangle and it is. I think the problem may be that the actor isnt entering or exiting the region instead the region is being placed on the top of the actor. I will post images of both behaviours below.

Thanks. George.

00george

  • Posts: 161
Bump. Would be really grateful.

Xietao

  • Posts: 725
The actors when enters  the selected attributes was the same.
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

Satyre

  • *
  • Posts: 270
Try this out:

when drawing
if dragging?
  if selected?
  draw text "text must be entered here not a boolean" at (x:100 y:100)

when troops enters selected region
  set selected? = true

when troops exits selected region
  set selected? = false

always
  if selected? = true
    switch to frame 1 for self
  if selected? = false
    switch to frame 0 for self


Otherwise you could try to change the frame directly when the troops enter the region instead of using a boolean, when you don't need it for other code regions.

00george

  • Posts: 161
Ok I give up I have done everything I can. I will post a link to the game. use up and down arrow keys to move the actors. Also I will post updated pictures of the behaviours. If you can help it will be much appriecated. http://www.stencyl.com/game/play/13184 Also use the mouse and click and drag to move the region.

« Last Edit: June 15, 2012, 12:38:12 pm by 00george »

Satyre

  • *
  • Posts: 270
Ok, try this one:

1. delete from the second behaviour:

if selected = true
switch to frame 0 for self
if selected = false
switch to frame 1 for self
set selected to selected?
set selected to selected?


2. add to the first behaviour:
when troops enters region
switch animation to frame 1

when troops exits region
switch animation to frame 0


if it doesn't work, then you can upload your test file to the forge and I'll try to modify it for you.

« Last Edit: June 15, 2012, 01:16:42 pm by Satyre »

00george

  • Posts: 161
After deleting the actor and replacing him. I finally got him to work. Satyre thank you so much for help. :)