Jump to content


MattClark1000

Member Since 05 Nov 2003
Offline Last Active Sep 08 2012 01:33 PM

Posts I've Made

In Topic: How to move objects on user end with mouse

08 July 2012 - 12:16 AM

this is an oldish post so i didnt read the whole thing again. but how about just centralising the origin? its what most people have...


right, that's all fine and dandy, and what most people do.  But when i get this working, I am going to need it to snap to a grid, the size of the sprite.  And when it snaps, it snaps at the origin.  if the origin is in the center, then it won't snap to where it belongs, and will be off the grid.   For a little clarification, I am intending on building a Battleship clone, and when the ships are dragged over, to be placed on the board, they need to snap to the grid when they are placed.  the best way to do this is to keep the origin up in the corner, at (x=0, y=0).

In Topic: How to move objects on user end with mouse

07 July 2012 - 09:34 PM


I would put in any object to be picked up:
create event:
var, then set it to picked_up = false

left mouse press event:
var, picked_up = true

step event:
Execute a piece of code,

{
if picked_up = true then
     {
      objectname.x = mouse_x  // changes the x position of "objectname" to the x position of the mouse. 
      objectname.y = mouse_y  // changes the y position of "objectname" to the y position of the mouse. 
     }
}
left mouse release event:
var, picked_up = false

The reason it is left mouse release and not global left mouse release is the mouse will be on the object you pick up always, until you drop it.
the begin bracket block and end bracket blocks look like this:
:GM063: :GM066:

Wow i never thought that I would be able to use code but this work 100% THANK YOU!!!!!!!!!!!!!!!!!!!


OK, this works, to a point....  the problem with this, is that this doesn't really work out in some instances.  For example, just to test it out, I used one of the round token sprites from the board game resources that come with GM8.1 (token_red.png, which is 48x48). This sprite has a transparent area around it, and if you have the sprite's origin set at (x=0, y=0), which is the top left corner, or anywhere where it's transparent, then when you release the mouse button, it does not release and drop the object.  I was able to fix this, by changing the collision mask so that it covers the whole image, including the transparent areas.

Even though what I did with the mask is a nice workaround, I need the collision masks to be precise, and only cover the actual image area, not the transparent area around it.  So how can we modify the code to fix this?

In Topic: Begemed 2 -- The Bejeweled 2 Fangame!

10 June 2012 - 02:24 AM

All links to download this are dead.

In Topic: Official library 03 - main2

20 December 2011 - 08:21 PM

Not a soul has a thing to say?  Because I dug a bit deeper into it, and I found out that 03 - main2, is not the only library like this.  

Everything that is in GM7, that is missing from GM8 is:

01 - move: missing the entire "Steps" category
03 - main2: missing "Show Info", and "Show Movie" under the Info Category,
06 - extra: missing the entire "CD" category; missing "Show Webpage" under 'Other' category

Sure, there's still GML actions for all of this in GM8.  But if it was in GM7 as D&D, it should still be in GM8 as D&D.

In Topic: Sprite rotation

30 August 2011 - 12:02 PM

I am not using Lite, I have 8.1 Standard. And of course I could use image_angle. But then that does the same thing - it rotates it at the center.

I think it'd be a lot simpler if it was just an additional option in the feature, to select how it's to be rotated, either at the center or at the origin.

Maybe someone can make an extension or something to do it?