Jump to content


Photo

move pad iphone like


  • Please log in to reply
7 replies to this topic

#1 tomasart

tomasart

    GMC Member

  • GMC Member
  • 197 posts

Posted 14 March 2012 - 11:56 AM

Anyone know how to do this? I have do some test to make a toucheble move pad for ihone/android games but not work properly. Anyone have do it or have link to a working example?
  • 0

#2 howabout

howabout

    GMC Member

  • GMC Member
  • 99 posts

Posted 14 March 2012 - 12:14 PM

Anyone know how to do this? I have do some test to make a toucheble move pad for ihone/android games but not work properly. Anyone have do it or have link to a working example?

I can tell you are not from here. Do you mean something like a 3DS Analog that slides around like this?(on the very left or very right):
Posted Image
Or touch controls like this:
Posted Image
Or like this maybe?:
Posted Image
  • 0

#3 tomasart

tomasart

    GMC Member

  • GMC Member
  • 197 posts

Posted 14 March 2012 - 01:13 PM

i mean touch controls
  • 0

#4 howabout

howabout

    GMC Member

  • GMC Member
  • 99 posts

Posted 14 March 2012 - 01:25 PM

i mean touch controls

Oh okay. So for touch controls like one button in the lower left corner for moving left, one next to that for right and then the one at the far end of it for the up key? if your room was default 640x480 you would just have an object in every room that has this in its create event:
YoYo_AddVirtualKey(0,480-128,128,128,vk_left)
YoYo_AddVirtualKey(128+16,480-128,128,128,vk_right
YoYo_AddVirtualKey(640-128,480-128,128,128,vk_up)
And then if you wanted to show them so you can see them you could make seperate objects with these codes for each of them and then assign them the button sprite that has to be 128 by 128
left button object step event:
YoYo_AddVirtualKey(x,y,128,128,vk_left)
x=view_xview[0]
y=view_yview[0]+480-128
right button object step event:
YoYo_AddVirtualKey(x,y,128,128,vk_right)
x=view_xview[0]+128+16
y=view_yview[0]+480-128
and jump button step event(you have to have jump assigned to the up button):
YoYo_AddVirtualKey(x,y,128,128,vk_up)
x=view_xview[0]+640-128
y=view_yview[0]+480-128


SO! This is all assuming that you only need basic platform movement and jumping codes and that your room size is default. You can change the values depending on the room sizes and all that and the buttons you want it to be. If you dont have a view you can just get rid of the view_xview and view_yview and then you can change the values. 640 represents the room width and 480 represents the room height so you can change them accordingly. 128 is the size of the button. this will put the left and right buttons 16 pixels apart from eachother aswell.
  • 0

#5 tomasart

tomasart

    GMC Member

  • GMC Member
  • 197 posts

Posted 15 March 2012 - 12:14 AM


i mean touch controls

Oh okay. So for touch controls like one button in the lower left corner for moving left, one next to that for right and then the one at the far end of it for the up key? if your room was default 640x480 you would just have an object in every room that has this in its create event:
YoYo_AddVirtualKey(0,480-128,128,128,vk_left)
YoYo_AddVirtualKey(128+16,480-128,128,128,vk_right
YoYo_AddVirtualKey(640-128,480-128,128,128,vk_up)
And then if you wanted to show them so you can see them you could make seperate objects with these codes for each of them and then assign them the button sprite that has to be 128 by 128
left button object step event:
YoYo_AddVirtualKey(x,y,128,128,vk_left)
x=view_xview[0]
y=view_yview[0]+480-128
right button object step event:
YoYo_AddVirtualKey(x,y,128,128,vk_right)
x=view_xview[0]+128+16
y=view_yview[0]+480-128
and jump button step event(you have to have jump assigned to the up button):
YoYo_AddVirtualKey(x,y,128,128,vk_up)
x=view_xview[0]+640-128
y=view_yview[0]+480-128


SO! This is all assuming that you only need basic platform movement and jumping codes and that your room size is default. You can change the values depending on the room sizes and all that and the buttons you want it to be. If you dont have a view you can just get rid of the view_xview and view_yview and then you can change the values. 640 represents the room width and 480 represents the room height so you can change them accordingly. 128 is the size of the button. this will put the left and right buttons 16 pixels apart from eachother aswell.


thanks so much.
  • 0

#6 fronogy

fronogy

    GMC Member

  • New Member
  • 1 posts
  • Version:Unknown

Posted 15 March 2012 - 06:57 AM

Any ideas how to implement onscreen analog stick?
  • 0

#7 howabout

howabout

    GMC Member

  • GMC Member
  • 99 posts

Posted 15 March 2012 - 12:03 PM

Any ideas how to implement onscreen analog stick?

No idea. My guess is it might have something to do with something like a dragging(obviously) And then in the mouse clicking event it first checks if the point_distance(x,y,(however much you want to be able to slide it out),(once again)) Is true and if it is then dont move it anymore but then the problem with that is that it wont be able to move around at all which isnt what anybody wants. This is something that has stumped me alot because i have also tried to make a rope using point_distance but theres once again still the problem of the movement. Its the same concept though, so maybe you can find something on the gmc.
  • 0

#8 King Tetiro

King Tetiro

    King of Orenna

  • GMC Member
  • 2186 posts
  • Version:GM8

Posted 15 March 2012 - 12:20 PM

I worked out how to produce an analog stick. I will be producing an example tutorial soon along with buttons.
  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users