Jump to content


Photo

Virtual Joystick on screen


  • Please log in to reply
14 replies to this topic

#1 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 06:07 AM

Posted Image

Can Anyone Please Tell Me How to Make The Character Move by Mouse clicking that Button!
Im Not Good in GML coding! i Know how to make that Character Move by Pressing Key board keys (by drag n droping stuff to 'step' n 'key press' events of Obj character!
im creating a Game for android Touch screen! so need to create a Virtual Joystick on screen!
Im new to GM,
i Create Sprites for Game Developers as a Part time Business, so im Good in Character n Background n room design...
But i wanted to make my own game so Bought GMS! :)
Any help would be much appreciated!


UPDATE!
Here is the Game so far,

http://shenalkm.0fees.net/

As You can see, the character can Move by the Keyboard.
I Want to make him Move when you Mouse click the Blue ball
(as When the Game loads in android, Mouse click means Touch)

Edited by shenalkm, 03 September 2012 - 08:54 AM.

  • 0

#2 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 06:31 AM

Anyone!?
  • 0

#3 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 759 posts
  • Version:GM:Studio

Posted 03 September 2012 - 06:33 AM

Analog or Digital.
  • 0

#4 blackhawkrobbo

blackhawkrobbo

    GMC Member

  • GMC Member
  • 948 posts
  • Version:GM:Studio

Posted 03 September 2012 - 08:00 AM

Analog or Digital.


What? Thats quite a weird question...

I think he means a big circle (128px wide) - the max distance of the center ball (the "stick"). Then you can press the "stick" and drag it around to make your character move that way.

I'll be on this in 9 hours! For now - please use Capitals at The right place And not at Random places in Your Sentences. tHanKs1
  • 0

#5 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 759 posts
  • Version:GM:Studio

Posted 03 September 2012 - 08:11 AM

If that's what he's looking for, it's being beat to death 5 posts below this one... And it's not a weird question. If its an analog stick I can pawn him off on someone else; if it's more of a digital gamepad setup, I have code I use for that, and could help him directly.
  • 0

#6 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 08:49 AM

Analog or Digital.


Im not sure.
I new to Game Development.
I will try to explain so you would understand,
this game is for touch screen devices,
6 buttons (small ones) like the one shown are displayed in the bottom of the screen,
when you click those, the character should do the relevant stuff.
for example when you press the 'Right button' (Blue one with the arrow) the character should Run to the Right direction.
Can you understand me or should i further explain!?
Thanks for the Quick reply!
  • 0

#7 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 08:52 AM


Analog or Digital.


What? Thats quite a weird question...

I think he means a big circle (128px wide) - the max distance of the center ball (the "stick"). Then you can press the "stick" and drag it around to make your character move that way.

I'll be on this in 9 hours! For now - please use Capitals at The right place And not at Random places in Your Sentences. tHanKs1


I should make that Big Blue ball with the arrow smaller...So 6 buttons can fit in the bottom of your touch screen android device.
Cool...hehe oh sorry i cant help it (using capital letters) :)
  • 0

#8 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 09:01 AM

If that's what he's looking for, it's being beat to death 5 posts below this one... And it's not a weird question. If its an analog stick I can pawn him off on someone else; if it's more of a digital gamepad setup, I have code I use for that, and could help him directly.


http://shenalkm.0fees.net/

Could you please Check this out...
I Want the codes to make the character move Right when we click the Big Blue Ball! :)
and of course i will add more buttons

I just made the button by creating another object n adding a sprite to it
i think if i made this using the Draw function its much better as it will move with screen right!? (if object following is assigned to the main character)
Can you send me your Codes please or help me out?
  • 0

#9 DaRk_bLaDe

DaRk_bLaDe

    Super Spy Fat Guy

  • GMC Member
  • 378 posts
  • Version:GM8

Posted 03 September 2012 - 10:56 AM

Please refrain from double posting :) wait 48 hours to bump :)
  • 0

#10 vann

vann

    GMC Member

  • GMC Member
  • 356 posts
  • Version:GM:Studio

Posted 03 September 2012 - 12:13 PM

The GML code you want to look into are the functions regarding virtual keys - virtual_key_add, etc.
Read up on them in the manual. They will create areas on screen that when pressed generate key presses. You can then use the key press events to run your code or drag and drop.
You would then place your sprites for the keys in the same place as each virtual key you define.

If you want a virtual analogue stick (like the sticks on an xbox/ps controller) check out this thread.
http://gmc.yoyogames...ual stick&st=0

Edited by vann, 03 September 2012 - 12:14 PM.

  • 0

#11 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 03:51 PM

Please refrain from double posting :) wait 48 hours to bump :)


Sure Mate! im new here!
  • 0

#12 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 03:54 PM

The GML code you want to look into are the functions regarding virtual keys - virtual_key_add, etc.
Read up on them in the manual. They will create areas on screen that when pressed generate key presses. You can then use the key press events to run your code or drag and drop.
You would then place your sprites for the keys in the same place as each virtual key you define.

If you want a virtual analogue stick (like the sticks on an xbox/ps controller) check out this thread.
http://gmc.yoyogames...ual stick&st=0


Awesome!!!
This is Exactly What im Looking For,
Thanks a Lot Mate!
You Rock! :)
  • 0

#13 blackhawkrobbo

blackhawkrobbo

    GMC Member

  • GMC Member
  • 948 posts
  • Version:GM:Studio

Posted 03 September 2012 - 04:56 PM

Crap. I just made this one:
http://gmc.yoyogames...howtopic=552875
  • 0

#14 shenalkm

shenalkm

    GMC Member

  • GMC Member
  • 31 posts
  • Version:GM:Studio

Posted 03 September 2012 - 05:38 PM

Crap. I just made this one:
http://gmc.yoyogames...howtopic=552875


Thanks a Lot Mate! this is Cool.
Will definitely Use this in a Future Project, i like this
and will Put Your Name in Credits :)
  • 0

#15 blackhawkrobbo

blackhawkrobbo

    GMC Member

  • GMC Member
  • 948 posts
  • Version:GM:Studio

Posted 03 September 2012 - 09:58 PM


Crap. I just made this one:
http://gmc.yoyogames...howtopic=552875


Thanks a Lot Mate! this is Cool.
Will definitely Use this in a Future Project, i like this
and will Put Your Name in Credits :)


No problem! I noticed that my code has way less lines, might be more of use?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users