Jump to content


Photo
* * * * * 1 votes

Auto Tile Your Walls By Nocturne


  • Please log in to reply
67 replies to this topic

#41 Αnt

Αnt

    GMC Member

  • GMC Member
  • 52 posts
  • Version:GM:Studio

Posted 01 September 2010 - 09:29 AM

Oh there is one thing that I'd like to change. If you look at the picture below, the left half is how the game currently looks, but I'd prefer it to look like the right side so the room's edge is treated as a wall. Is there an easy way of implementing this?

Posted Image
  • 0

#42 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 01 September 2010 - 09:41 AM

Well thanks for the compliment ant!

The only way to do as you ask, is to place instances OUTSIDE the room... Or create a special instance and instead of have it run the script, tell it directly which of the sprites/tiles it should be. This can be done by creating a seperate object with no create code and then in the room editor you press <CONTROL> and RMB on the object. At the bottom of the pop-up menu is "creation code" or something similar. This opens a very useful codebox that allows you give ONLY THAT INSTANCE code that is run BEFORE the create event. In this code box you can tell the object what tile or sprite index it should have... Itīs a bit tedius for large games, but my latest game "Black Out" uses this for almost every object in the game! Which is why each level took about 4 days to complete... Oh and you would probably have to create a parent for all wall objects so that the rest of them detect properly the "empty" edge objects...
  • 0

#43 Αnt

Αnt

    GMC Member

  • GMC Member
  • 52 posts
  • Version:GM:Studio

Posted 07 September 2010 - 09:53 AM

Hmm... I'm having a bit of a problem trying to get the room's edge to act like a wall when tiling. What I've currently done is create a big fake wall sprite that surrounds the whole of the level. The OuterWall is now the parent of the Walls and changed the script so it asks whether the wall collides with the OuterWall. Now this works great as long as I put the following code into the Wall's creation code:

instance_create(-12,-12,OuterWall);

The obvious problem is that it now creates a lot of OuterWalls which slows the game down. But when I replace it with the following code it completely fails to work:

if !instance_exists(OuterWall) {instance_create(-12,-12,OuterWall);}

I've tried creating the OuterWall at room creation and within a different object with a depth both above and below the Wall but the only way it works is if I put the instance_create in the Wall creation code. I've got no idea why it's behaving this way.
  • 0

#44 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 07 September 2010 - 09:55 AM

Hmmm.. Why donīt you pm me the gmk (or a cut down version so I can see the problem) and Iīll look into it sometime today and get back to you via pm? Itīs easier and quicker than posting in the topic!
  • 0

#45 Αnt

Αnt

    GMC Member

  • GMC Member
  • 52 posts
  • Version:GM:Studio

Posted 08 September 2010 - 01:21 PM

PM sent. ;)
  • 0

#46 df458

df458

    GMC Member

  • New Member
  • 1 posts

Posted 17 October 2010 - 09:14 PM

Finally, an autotile engine that I can get running in real time!
Thank you, I will certainly give credit for this!
  • 0

#47 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 14 January 2011 - 09:35 AM

Just giving this a wee bump, as i see other auto-tile examples have appeared... Posted Image

Mine may not be the best coded, but itīs still the only one that covers EVERY possible option (47 different tiles), comes with itīs own templates and can be used for tiles or sprites and real time or static...
  • 0

#48 BluePotato1994

BluePotato1994

    GMC Member

  • GMC Member
  • 184 posts
  • Version:GM8

Posted 14 January 2011 - 10:14 AM

NICE!!! I was playing around with it and made it so I could create the blocks while in game (Just with a little bit of code and changing the blocks creation event to a step event) and well it worked but I had some slight problems but apart from my mistakes this was great.
  • 0

#49 nitronhycerin

nitronhycerin

    GMC Member

  • New Member
  • 18 posts

Posted 19 March 2011 - 04:45 AM

This is really good. You even added a tile template in the folders! Awesome ten thumbs up from me :lol:
  • 0

#50 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 08 April 2011 - 08:18 AM

Since Iīve changed my user name Iīm bumping my examples so people can see them... public/style_emoticons/default/whistle.gif
  • 0

#51 powergannon123

powergannon123

    GMC Member

  • GMC Member
  • 274 posts

Posted 09 April 2011 - 11:32 PM

Hey, I think I used this before. I suggested that you include the photoshop base, right? Cool. You used it.
  • 0

#52 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 10 April 2011 - 05:50 AM

I canīt remember who suggested what... itīs been a looooooong time since I first posted this!!! But anyway, if it was you then thanks as a lot of peole have a thanked me for the addition, and it does make the whole example/tutorial MUCH easier to use!
  • 0

#53 kjburnell

kjburnell

    GMC Member

  • New Member
  • 2 posts

Posted 11 June 2011 - 03:13 AM

alright what would I have to change in the code to get the auto_tile to process a different type of tile set. Here are what I am working with.

Wall Tile Set
  • 0

#54 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 11 June 2011 - 06:13 AM

Kjburnell, it's YOU that should change the tileset to use my code, as adapting my code to your tileset would take a long time and is unnecessary! Just cut and paste the pieces you need into the template and make sure not to use any other joints except the ones supported by your tileset when setting up yoour room... alternatively (and I think this is possibly better) it may be that the Autowall example by Chronic is what you are after as I think it covers a tileset with similar properties to the one you post (but I may be wrong!)... even then, you will need to cut and paste your image into the template on his topic to get it to work.
  • 0

#55 orange08

orange08

    Art Game Movement

  • GMC Member
  • 2194 posts
  • Version:GM:HTML5

Posted 22 January 2012 - 12:55 AM

This works perfectly in my game! Thanks heaps, Nocturne! :)
  • 0

#56 ND4SPD

ND4SPD

    GMC Member

  • GMC Member
  • 2167 posts

Posted 22 January 2012 - 02:47 AM

Looks like a good system, but a little inefficient. Would it be better to have some temp variables, like r,tp,t,tl,l,bl,b,br that hold whether there is a collision to the right, topright, top, topleft, left, bottomleft, bottom, bottomright, so that you dont have to keep calling place_meeting()?

EDIT: This would also solve Ant's problem. Set all the temporary variables based on place_meeting() and whether or not the coordinates you're testing (such as [x,y+32]) lie outside the room.

Edited by ND4SPD, 22 January 2012 - 02:49 AM.

  • 0

#57 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16790 posts
  • Version:GM:Studio

Posted 22 January 2012 - 07:14 AM

Looks like a good system, but a little inefficient. Would it be better to have some temp variables, like r,tp,t,tl,l,bl,b,br that hold whether there is a collision to the right, topright, top, topleft, left, bottomleft, bottom, bottomright, so that you dont have to keep calling place_meeting()?

EDIT: This would also solve Ant's problem. Set all the temporary variables based on place_meeting() and whether or not the coordinates you're testing (such as [x,y+32]) lie outside the room.


This CAN be done better, yes... But I wrote it before I knew too much about GML!!! And I haven't changed it because in it's current form it's VERY newbie-friendly, in that it's easy to see exactly how and why it works. Thnaks for the comments however!

Oh, and thank you orange08!!! Glad you like it!
  • 0

#58 ND4SPD

ND4SPD

    GMC Member

  • GMC Member
  • 2167 posts

Posted 22 January 2012 - 02:05 PM


Looks like a good system, but a little inefficient. Would it be better to have some temp variables, like r,tp,t,tl,l,bl,b,br that hold whether there is a collision to the right, topright, top, topleft, left, bottomleft, bottom, bottomright, so that you dont have to keep calling place_meeting()?

EDIT: This would also solve Ant's problem. Set all the temporary variables based on place_meeting() and whether or not the coordinates you're testing (such as [x,y+32]) lie outside the room.


This CAN be done better, yes... But I wrote it before I knew too much about GML!!! And I haven't changed it because in it's current form it's VERY newbie-friendly, in that it's easy to see exactly how and why it works. Thnaks for the comments however!

Oh, and thank you orange08!!! Glad you like it!

Surely it'd still be "newbie-friendly"? Especially if it solves someones problem. Not saying you have to change it! Just seems like a faster, better way of doing things.

If Ant is reading this, you now know how to fix it! Just swap out the place_meeting() functions with variables!
  • 0

#59 Merlocker

Merlocker

    No Imagination

  • GMC Member
  • 450 posts
  • Version:GM8

Posted 16 July 2012 - 10:10 PM

I know I'm bumping this but.....
This is great Nocturne! now I don't have to be at the computer for another 5 mins trying to put titles in the room, and to make sure there all there.
  • 0

#60 C_Pike

C_Pike

    GMC Member

  • GMC Member
  • 565 posts
  • Version:GM8.1

Posted 03 September 2012 - 01:28 PM

This is almost exactly what I need. (tiles created by ds_grid without objects. I just need to change the script to a ds_grid_value_exists ds_grid_get check as opposed to a place_meeting check)
Thanks for the millionth time Nocturne. You are an awesome person for helping as much as you do.

Edited by C_Pike, 03 September 2012 - 04:03 PM.

  • 1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users