Jump to content


Photo

Drawing suface and moving them


  • Please log in to reply
3 replies to this topic

#1 Alive Max

Alive Max

    GMC Member

  • New Member
  • 42 posts

Posted 31 May 2012 - 05:33 AM

hi there!
i am making a game that first you drawing on surface but when you pressed Up {it move forward} if you pressed left and right then it change his {direction}
the drawing is working good, the problem is that ,i don't know how to add the other action like moving {forward} changing {direction} to it. :wacko:

here is the code i used

:GM123:
//Create Even
if mouse_check_button(mb_left){
mxp=mx
myp=my
}
else {
mxp=mouse_x
myp=mouse_y
}
mx=mouse_x
my=mouse_y

:GM129:
//Global Mouse Left Button
surface_set_target(surface)
draw_line(mx,my,mxp,myp)
surface_reset_target()

:GM130:
//Game Start Even
surface=surface_create(640,480)
mx=mouse_x
my=mouse_y
mxp=mouse_x
myp=mouse_y
:GM131:
//Draw Even
draw_surface(surface,0,0)

i know that there are function for adding surface as sprite, but i don't know how to use them please help me! :confused: :wallbash:

Credit will be given

Edited by Alive Max, 31 May 2012 - 05:36 AM.

  • 0

#2 CyrusRoberto

CyrusRoberto

    GMC Member

  • New Member
  • 21 posts
  • Version:GM8

Posted 31 May 2012 - 06:31 AM

//Draw Even
draw_surface(surface,0,0);


The X and the Y coordinates of the surface are set to (0,0), which is the upper left corner of the screen. Try changing the code to

draw_surface(surface,mx,my);
or, more simply
draw_surface(surface,mouse_x,mouse_y);
I don't see the point of having the mx, my, mxp, myp variables if the mouse coordinates can be accessed directly.

Edited by CyrusRoberto, 31 May 2012 - 06:35 AM.

  • 0

#3 Alive Max

Alive Max

    GMC Member

  • New Member
  • 42 posts

Posted 31 May 2012 - 07:54 AM

//Draw Even
draw_surface(surface,0,0);


The X and the Y coordinates of the surface are set to (0,0), which is the upper left corner of the screen. Try changing the code to

draw_surface(surface,mx,my);
or, more simply
draw_surface(surface,mouse_x,mouse_y);
I don't see the point of having the mx, my, mxp, myp variables if the mouse coordinates can be accessed directly.


it work fine, but i want when i release the mouse button it must be a SEPARATE instance with his own action and when i draw again it must be anther SEPARATE object and ...
i mean each time i try to draw it must draw it as a SEPARATE {instance or object} with his own actions.
  • 0

#4 Alive Max

Alive Max

    GMC Member

  • New Member
  • 42 posts

Posted 31 May 2012 - 02:40 PM

Does anyone else have any idea? :unsure:
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users