I have just started to use gamemaker and have made my first very basic game, it's just a circle that moves with the arrow keys.
My problem is that when it moves it leaves behind an image of itself in every space that it occupies.
All I have is $motion_set(0, 5);$ as the action.
Any help is much appreciated!
I am not really familiar with Studio 2 but in 1.4 your code causes my sprite to move across the screen without leaving anything behind. Are you sure there is nothing else in your code. It seems to be re-creating a new sprite either at the old location or creating a new object at the old location.
You can also you x += (the ammount of pixels you want to move) This works for x and y.
Thanks, Jonathan Greene
Related
ok I've been searching everywhere and cannot understand this, hopefully someone here can help!
I am building a game in unity with an isometric tilemap, and apparently I can't grasp the whole sorting issue, cause nothing I do works as I wish...
to start this is the scene: basic scene with player
the whole basic scene is in one tilemap (I also have a map for collision, floor and upper level but those aren't relevant to the problem in hand - at least I don't think so...), which is set to individual and the graphic settings are 0,1,1 (I also tried changing those with no success)
when the player stands close to a tile it sorts incorrectly incorrect sorting, obviously this is solved if I change to chunk mode but then everything else gets messed up chunk mode, tables sort wrong and also this happens for some reason - the player sorts behind some of the tiles player sorts behind tile
any help would be appreciated
omer
I am a student building a senior project in Gamemaker Studio for our capstone project as part of my Game Development concentration.
I am in charge of sprite creation, and currently, it is randomly deleting bits as I draw. So I will draw a couple of bits, and then it will randomly remove the surrounding bits of color. I am becoming increasingly irritated at this and I have no idea why this is happening. Any help would be greatly appreciated.
Effectively, I am designing a character and I'm trying to give his arms a bit more depth so I give him a few more tan-colored muscles. As I do, it erases the rest of his arm.
If you mean the Sprite Editor, then I recommend you using a different program for the sprites, as that one is completely garbage. I'm using Paint.net, its free and works in a similar way like the gms2 sprite editor but better. more plugins, more effects, better shortcut handlings.
If you still wanna stick to the gms2 sprite editor then I'll recommend restarting the game first. that's a problem I never had. Maybe you should check if you are drawing in different layers, and the blend modes of the layers. also maybe your brush is not just a pixel, but maybe a bigger brush.
I have a simple 2D game and I have a strange problem whenever a level is loaded several of the objects that include platforms and enemies won't display on screen and neither do the 2D background but all the objects are there, I can see it in the hierarchy and they are functioning as they should like killing the player and such. They just don't show up on the screen. I was finally able to show them while pausing the player during gameplay and set the z position of the camera to -11 and above but every time the level reloads like after the death of player, the same problem happens.
I even tested it on the mobile device but the same problem occurs furthermore I can't even interact with any of the UI buttons on the level, even though I check that all the code for them is appropriate.
Please help.
EDIT:
Okay after reading, your replies, I thought may be this will help. O always get these errors every time I load up this project in unity but they disappear once the game is running.
As you can see the platforms and enemies does appear on the camera frustum but when I start the game they disappear.
Okay, I finally found the problem. After lot of head scratching and testing I found that the objects that weren't appearing on screen has their z-position set to -10 which is the same of that of camera's z-position.
The problem was I was using this code to set the position of objects in the Awake method:
transform.position = camera.main.ViewportToWorldPoint(new Vector3(x, y, 0));
What's actually happening is all the x, y, and z co-ordinates were setting related to the camera's position. So setting the z-position to 10 fixed it for me.
Thanks everyone for helping me.
It's probably because near clipping of your cam is to high; Set it to 0.1 and try it again.
Recently I've been trying to create something I've always wanted, but never had the skill and time to do - a computer game. To be more precise, a homage / clone of one of many of my favourite games. To start with something simple I've decided to create a classic 2D platform based on the Castlevania series.
Being a Ruby programmer I've decided to use Gosu. Then I decided I don't want to reinvent the wheel so I'm going to use Chipmunk.
After a few days, I've ended up having inexplicable collision detection problems. I've added boundary-box drawing functions just to see what the hell is going on.
As you can see, Belmont collides with blocks of walls he's not remotely close to touching. Since the demo game included with gosu gem works fine, there must be something wrong I'm doing, I probably don't really udnerstand how a polygon Shape is defined and added to the space. I'm pretty sure it's not really where I draw it.
There's a public repo with the game, so you can see how walls (Brush < Entity) and player (Player < Entity) are defined and that they indeed have a simple, rectangular polygon shape. Walls are not added to the space (they are rogue), only the player is. I've tried debugging the game and see where the body position is, but all looked fine.
https://github.com/ellmo/castellvania
Player falls down slowly, but you can control him with up / left / right arrows. Tilde button (~) shows the boudning boxes and the collision boxes are supposed to be always visible.
I need some help trying to understand what am I doing wrong.
I probably don't really udnerstand how a polygon Shape is defined and added to the space. I'm pretty sure it's not really where I draw it.
That's it. Shape coordinates are added to the body position, not substracted from it.
In your Entity.boundaries replace the line
verts << CP::Vec2.new(#shape.body.p.x - #shape[vert].x, #shape.body.p.y - #shape[vert].y)
with
verts << CP::Vec2.new(#shape.body.p.x + #shape[vert].x, #shape.body.p.y + #shape[vert].y)
and you will get correct picture. (drawing will be still broken, but bounding boxes will be correct.
I am still shiny new to XNA, so please forgive any stupid question and statements in this post (The added issue is that I am using Visual Studio 2010 with .Net 4.0 which also means very few examples exist out on the web - well, none that I could find easily):
I have two 2D objects in a "game" that I am using to learn more about XNA. I need to figure out when these two objects intersect.
I noticed that the Texture2D objects has a property named "Bounds" which in turn has a method named "Intersects" which takes a Rectangle (the other Texture2D.Bounds) as an argument.
However when you run the code, the objects always intersect even if they are on separate sides of the screen. When I step into the code, I noticed that for the Texture2D Bounds I get 4 parameters back when you mouse over the Bounds and the X, and Y coordinates always read "X = 0, Y = 0" for both objects (hence they always intersect).
The thing that confuses me is the fact that the Bounds property is on the Texture rather than on the Position (or Vector2) of the objects. I eventually created a little helper method that takes in the objects and there positions and then calculate whether they intersect, but I'm sure there must be a better way.
any suggestions, pointers would be much appreciated.
Gineer
The Bounds property was added to the Texture2D class to simplify working with Viewports. More here.
You shouldn't think of the texture as being the object itself, it's merely what holds the data that gets drawn to the screen, whether it's used for a Sprite or RenderTarget. The position of objects or sprites and how position/moving is handled is entirely up to you, so you have to track and handle this yourself. That includes the position of any bounds.
The 2D Rectangle Collision tutorial is a good start, as you've already found :)
I found the XNA Creator Club tutorials based on another post to stackoverflow by Ben S. The Collision Series 1: 2D Rectangle Collision tutorial explains it all.
It seems you have to create new rectangles, based on the original rectangles moving around in the game every time you try to run the intersection method, which then will contain the updated X and Y coordinates.
I am still not quite sure why the original object rectangles position can not just be kept up to date, but if this is the way it should work, that's good enough for me... for now. ;-)