Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Well there are multiple ways to do this but what you can do is check for a collision with the player. If the collision is true check if the player is above below to the left or right of the object, then move the obj by 1 in the opposite direction until collision = false (I'd also have a counter so if it loops through the code more than a few times it breaks from the loop) you could do a similar thing for the maze walls to keep it from being pushed into them. There is probably a better way to do it though.
or
Put this little guy in the collision event (exe piece of code) in BOTH objects...
x += 0.1*(x-(other.x))
y += 0.1*(y-(other.y))
small code can do wonders, tweak as needed...
to answer you question you need to create 3 things.
1 - your sprite
2 - an object that your sprite can attach to
3 - a room in which your object can be place.
A sprite is the image that you want to show the player of your game - this could be a character.
An Object will hold all the functions. You attach the Sprite to the object so that the player can see what the object represents. For example: If you want to create a wall. You would create a sprite, and within this sprite, you would draw a wall. Next you would create a new object (and call it wall) and attach the sprite to this object so the player can see it is a wall. You would then add the functions that make the wall a wall, such as a collision to stop other objects passing through it.
Next you need to create a room, from here you can place the Wall Object anywhere you like within the room while essentially makes the levels.
Generally you want to name everything the same, but with a 'title' so you know which 'wall' is an object or a sprite.
sprites are typically titles spr. So for a wall, you should call the:
Sprite 'spr_wall'
Object 'obj_wall'
Room 'rm_level_1'
Remember, the reason room isn't entitled 'Wall' is because this is where all the wall objects are places to make a level.
These rooms can also be used for other things such as introductions, title pages etc. The room is what the player is presented with when they load the game.
There's a tone of tutorials on Youtube and on GameMaker, check them out sometime.