Help with actor select and on click mouse movement.

zedapple

  • Posts: 2
I am new to stencyl and I want to create a tactical strategy game.  I have been trying to figure out how to select different actors and have them move independently to a click area on the map.  For example, if I want to move a swordsman, I click the swordsman and then click on where I want to move him on the map and just he moves there.  Same thing with an archer or pikeman.  Eventually I want to add attack attributes to each unit as well.  Is this possible with stencyl?  If it is, what is the best way to go about doing this?  I found a youtube video located here: https://www.youtube.com/watch?v=JOhFlpvElrQ  This is exactly what I want to do but I can't find anywhere that helps me solve this problem.  Thanks. 

Hi Zedapple

Welcome to the forums and to Stencyl.

I love those types of games. Let me write a few blocks of code and I'll post back in a sec.

Here you go...

Click the soldier and then choose his destination.

It works in both flash and iOS.

<a href="http://www.firecroc.com/rts.swf" target="_blank" class="new_win">http://www.firecroc.com/rts.swf</a>

I've attached the behaviour.

1) Start stencyl

2) Click on Actor Behaviours

3) Choose import on the top bar

4) Create an actor

5) Attach the behaviour to it.

EDIT: I've commented out the behaviour so have a look to see what each part does.  :)

Stencyl is perfect for this kind of game. The path finding will be the tough part but with work it's definitely possible. I'd certainly look into learning how to make your own behaviours and research into how to use Stencyl. But this behaviour I've made should be a good start.

Hope this helps and let me know if you get stuck!

Tom

« Last Edit: July 26, 2012, 02:36:08 am by Tom - FireCroc Games »

arrested

  • Posts: 39
First; let me apologize for the thread necromancy.

This is exactly what I am looking for; where can I find the actual code/process/tutorial for this?  The attachment is the hammer png file, and the embedded flash is nothing I can dig into :)

Thanks!
-------------------------
"Would you classify that as a launch problem or a design problem?"

Ceric

  • *
  • Posts: 610
Hey Arrested, actually just save the file to your desktop and then drag it from your desktop into the Behaviors area in Stencyl. That will actually upload the full Behavior into Stencyl (FYI I just did this and it uploaded the Behavior).

ipe 369

  • Posts: 1001
Also try applying a change in saturation effect or something :) that'd look pretty cool :D

arrested

  • Posts: 39
Hey Arrested, actually just save the file to your desktop and then drag it from your desktop into the Behaviors area in Stencyl.

I swear I must have some sort of synaptic malfunction - I don't even see a file attachment other then the embedded SWF file (which I cannot save/drag), and the hammer icon; which is just a png file and not a behavior at all.. unless (and I am sure this is the case) I am missing some big glaring obvious thing...
-------------------------
"Would you classify that as a launch problem or a design problem?"

captaincomic

  • *
  • Posts: 6108
The behavior is stored in the PNG's metadata ;). You can drag the PNG into Stencyl or use the Import... button.

arrested

  • Posts: 39
ok.. thats something I really was not expecting.

Thanks :)
-------------------------
"Would you classify that as a launch problem or a design problem?"

JessicaAlbert

  • Posts: 2
Thank you for the behavior code given. That's really what i need for. But can you help me on how to make the actor return  to its initial position automatically? i mean how to make it go back to its position after it went to the clicked destination? Sorry and thanks in advance for those who are willing to help  :D

JeffreyDriver

  • *
  • Posts: 2205
Use attributes to record the actors starting location. Check if the actor is at the clicked location, if so simply send it back.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk