Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Re] LttP block 16x16 grid move!  (Read 3572 times)

0 Members and 1 Guest are viewing this topic.
[Re] LttP block 16x16 grid move!
« on: November 12, 2006, 11:49:06 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Hey ppls.

I need to know how you can get a block to move like what you see in Link to the Past.
If you played it then you know what I mean.  Its those blocks that you can move that always stay in 16x16 grid.
if you know how, It would be greatly appreciated if you could TELL me or make an example, I will accept either or.
Thank you :)

Love
-Mewgull
Logged

Koh

Re: [Re] LttP block 16x16 grid move!
« Reply #1 on: November 13, 2006, 01:29:42 am »
  • Tamer Koh
  • *
  • Reputation: +6/-0
  • Offline Offline
  • Gender: Male
  • Posts: 980
same here, I was about to ask the same things, but I was busy, could you do the same for me plz and thanks.
Logged
  • Megaclipse Games

King Tetiro

Leader of Phoenix Heart
Re: [Re] LttP block 16x16 grid move!
« Reply #2 on: November 13, 2006, 05:53:09 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I needed that as well! + A Pushing engine.
Logged
  • Phoenix Heart

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #3 on: November 13, 2006, 07:28:58 am »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
All right, coming through... :ganon:

I'll try to help, but we can't write an engine for this without knowing certain parts of your movement code, and a few details of how the blocks should move.

1) What variable(s) do you use to tell which way Link is walking? This is needed because you won't want the block to move if you touch it while walking perpendicular or something.

2) What's the code and event you use for "if the place is free, move Link"? Needed because you may not be able to use collision events with the blocks, since the code may stop you from even "officially" colliding with it in the first place. So another condition is needed: "if the place is not free, check if it's occupied by a pushable block (and if so, get its id)."

3) Can the blocks be pushed only once, or more, or will it vary between blocks?

4) Can you push a block only in certain direction(s), or any, or will it vary?

If there will be all kinds of different settings for various blocks, the clear course of action would be to use a parent. After that's all cleared up, it shouldn't be hard.

Consider that you need to walk against the block for about half a second before it moves. That can be done by giving the block a variable called "count". When the code determines that you're walking against it, "count" will raise by 1, and an alarm for the block will be set to 1. In that alarm event, count resets to 0, so that when you stop pushing you have to start over again.

The step event can check for when count=15 or so, then switch a few variables and put it in motion. I think if the block moves at a speed of 1 (pixel per step) it will take about half a second to move to the next place, which should look pretty much like LTTP. I'll work on the exact code later, maybe. :P

[edit]
How cute, somebody set my avatar to Tingle. :-*
« Last Edit: November 13, 2006, 07:34:28 am by Goodnight »
Logged
Re: [Re] LttP block 16x16 grid move!
« Reply #4 on: November 13, 2006, 12:25:23 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
1) "global.facing=Left, Right, Down, Up"

2)            if !place_free(x,y-1) {
                if place_free(x-cc,y-1) && !(holdr || fholdr) { fholdl=1 }
                else if place_free(x+cc,y-1) && !(holdl || fholdl) { fholdr=1 } //This is for moving Up

3)Vary between Each block

4)Vary Between Each, please!

Thanks, I appreciate your help.  You are getting credited anyways XD... so I guess you get extra! ^_^
Logged

Koh

Re: [Re] LttP block 16x16 grid move!
« Reply #5 on: November 13, 2006, 02:18:09 pm »
  • Tamer Koh
  • *
  • Reputation: +6/-0
  • Offline Offline
  • Gender: Male
  • Posts: 980
mine is long so beware

1)global.facing="L""R""U""D"

2)
Code: [Select]
        if holdu {
            if !place_free(x,y-1) {
                if place_free(x-cc,y-1) && !(holdr || fholdr) { fholdl=1 }
                else if place_free(x+cc,y-1) && !(holdl || fholdl) { fholdr=1 }
            }
        }

3)Vary

4)Vary

But since I have a shield engine I have to know how to also let him push blocks if he is using or holding theshield look below

Code: [Select]
    if (!moving) && (A=="shield" or B=="shield") {
        if (holdd) { sprite_index=sprLinkHSD; global.facing="D" }
        else if (holdu) { sprite_index=sprLinkHSU; global.facing="U" }
        if (holdl) { sprite_index=sprLinkHSL; global.facing="L" }
        else if (holdr) { sprite_index=sprLinkHSR; global.facing="R" }
    }
    if (!moving) && usingshield{
        if (holdd) { sprite_index=sprLinkUSD; global.facing="D" }
        else if (holdu) { sprite_index=sprLinkUSU; global.facing="U" }
        if (holdl) { sprite_index=sprLinkUSL; global.facing="L" }
        else if (holdr) { sprite_index=sprLinkUSR; global.facing="R" }
    }

Code: [Select]
    if (holdd && !holdl && !holdr && (A=="shield" or B=="shield") ) { sprite_index=sprLinkHSD; global.facing="D" }
    else if (holdu && !holdl && !holdr && (A=="shield" or B=="shield" )) { sprite_index=sprLinkHSU; global.facing="U" }
    else if (holdl && !holdd && !holdu && (A=="shield" or B=="shield" )) { sprite_index=sprLinkHSL; global.facing="L" }
    else if (holdr && !holdd && !holdu && (A=="shield" or B=="shield" )) { sprite_index=sprLinkHSR; global.facing="R" }
    if (holdd && !holdl && !holdr && usingshield ) { sprite_index=sprLinkUSD; global.facing="D" }
    else if (holdu && !holdl && !holdr && usingshield ) { sprite_index=sprLinkUSU; global.facing="U" }
    else if (holdl && !holdd && !holdu && usingshield ) { sprite_index=sprLinkUSL; global.facing="L" }
    else if (holdr && !holdd && !holdu && usingshield ) { sprite_index=sprLinkUSR; global.facing="R" }

Code: [Select]
    if (holdd && holdl && (A=="shield" or B=="shield") && sprite_index!=sprLinkHSD && sprite_index!=sprLinkHSL) { sprite_index=sprLinkHSL; global.facing="L" }
    else if (holdd && holdr && (A=="shield" or B=="shield") && sprite_index!=sprLinkHSD && sprite_index!=sprLinkHSR) { sprite_index=sprLinkHSR; global.facing="R" }
    else if (holdu && holdl && (A=="shield" or B=="shield") && sprite_index!=sprLinkHSU && sprite_index!=sprLinkHSL) { sprite_index=sprLinkHSL; global.facing="L" }
    else if (holdu && holdr && (A=="shield" or B=="shield") && sprite_index!=sprLinkHSU && sprite_index!=sprLinkHSR) { sprite_index=sprLinkHSR; global.facing="R" }
    if (holdd && holdl && usingshield && sprite_index!=sprLinkUSD && sprite_index!=sprLinkUSL) { sprite_index=sprLinkUSL; global.facing="L" }
    else if (holdd && holdr && usingshield && sprite_index!=sprLinkUSD && sprite_index!=sprLinkUSR) { sprite_index=sprLinkUSR; global.facing="R" }
    else if (holdu && holdl && usingshield && sprite_index!=sprLinkUSU && sprite_index!=sprLinkUSL) { sprite_index=sprLinkUSL; global.facing="L" }
    else if (holdu && holdr && usingshield && sprite_index!=sprLinkUSU && sprite_index!=sprLinkUSR) { sprite_index=sprLinkUSR; global.facing="R" }


Code: [Select]
Credit goes to Goodnight and now he gets extra for the pushing
Does this pushing engine also include him pushing against the wall is he runs into a wall?
« Last Edit: November 13, 2006, 04:21:26 pm by dlbrooks33 »
Logged
  • Megaclipse Games

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #6 on: November 13, 2006, 09:07:28 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Okay.. so it looks like you two are using my movement engine or variations of it... that makes things easier for me. ;) Only problem is that code wasn't designed with regular wall-pushing in mind. That might make it imperative to have a "wall" parent for all types of wall or block solids, pushable or not.

Would you guys prefer the LTTP way where Link starts pushing about half a second after you run into the wall, or instantly like the GB games?

dlbrooks, I'll have to look through your shield code for a minute first, but please tell me, do you want to disable pushing while Link is using a shield?



I'll have to get back to this later for the pushing code.. sorry but I woke up really late today and still have a bunch of things to do. :D But to get you started, we can set up some variables in the block objects that will be useful for later.

Code: [Select]
//Create:

moving=0
movingdir=0
movesl=0
movesr=0
movesu=0
movesd=0
count=0
Code: [Select]
//Alarm 0:

count=0
The first two will always start at 0 and only change when they're moving. The next four "moves" variables can be changed for each different copy of this object; they will be the number of times this block can be moved in each direction.

Now for Parents: Make two new invisible objects, called objWall and objPushblock.

For every variation of pushable block that you make, set its Parent to objPushblock.

For every type of "wall" solid you have, (ie. invisible object you place in the maps to stop Link from walking there), set its Parent to objWall. OR, if you only have 1 type (the basic 16x16), that can be the objWall itself and you won't have to give it a Parent. It's just that my game uses different sizes of invisible solids, such 64x16, so I can fill up the level with a minimal number of instances. But, either way works.

Now, set objPushblock's Parent to objWall.

So, every type of pushable block will count as an objPushblock, which makes it easier to detect in code. Plus, every invisible solid  including pushable blocks will count as an objWall, which will be used to tell Link to use the pushing animation when he runs into it.

More code to follow...
Logged
Re: [Re] LttP block 16x16 grid move!
« Reply #7 on: November 13, 2006, 10:20:52 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
yay, thanks. and I am using your Movement example :D.  all off it ^_^
anyways.
I'll just suggest that you make an example and explain everything in that, becuase the internet is not reliable. but thats just a suggestion, I will take either one, if its explained here, or an example. I just thought that it would be easier.
thanks! its a start to the long process ^_^
Logged
Re: [Re] LttP block 16x16 grid move!
« Reply #8 on: November 17, 2006, 03:15:41 pm »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
uhh... bump, much? :P
Logged

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #9 on: November 17, 2006, 08:12:25 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Yes, it was a bump much. :P

I'm working on that example, gonna try to have it later today.

[edit]

The push coding is all done, but I also realised 2 fundamental flaws in the corner-cutting engine, so I'm fixing those up as well. It won't be much longer.

I really wanted to explain the process instead of just coding it myself, but it's probably better this way since I've hit a whole bunch of snags like that. There's been a lot of redesigning done to the Step event, so please don't mind if I take a bit of time to put in some comments explaining things.
« Last Edit: November 18, 2006, 07:59:48 am by Goodnight »
Logged

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #10 on: November 19, 2006, 02:01:11 am »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Presto!
http://www.geocities.com/spotandsmudge/LinkMovementPushing.zip
Sorry for the wait, it was quite a day... wasted lots of time thanks to somebody's laziness. ::)

Anyways, please read the Game Information and all the code comments. I re-wrote them to be as comprehensive as possible and to describe everything that's happening in the code. I didn't mind making this example because there were some snags that would have come up if I just described it here, but it's my goal to help users learn how to make these kinds of engines.
Logged
Re: [Re] LttP block 16x16 grid move!
« Reply #11 on: November 19, 2006, 05:15:05 am »
  • Personal Text
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1229
Thank you
I owe you a lot of credit!
You are smart, talented, and probally good-looking[/suckingup]
seriously, thanks. I love you ^_^

EDIT: I FOUND THE BIGGEST SNAG!  its a .gmd  :o

EDIT2: lmfao, nvm, its fine! everythings fine! :P thanks again
« Last Edit: November 19, 2006, 05:20:16 am by Mewgull »
Logged

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #12 on: November 19, 2006, 05:37:11 am »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Aw, hell. Two out of three isn't bad. ;D

Just remembered - the script scrCornerCut is not needed. That was there for testing new methods that didn't work, and I forgot to take it out.

If anyone else (Laigonaz, dlbrooks33, et al) has questions or needs something altered, go for it..
Logged

Koh

Re: [Re] LttP block 16x16 grid move!
« Reply #13 on: November 21, 2006, 02:08:25 am »
  • Tamer Koh
  • *
  • Reputation: +6/-0
  • Offline Offline
  • Gender: Male
  • Posts: 980
thanks good night, now I can study this over and over until I can do it an easier way later on in life,

GN=good influence.
Logged
  • Megaclipse Games

paloupa

Re: [Re] LttP block 16x16 grid move!
« Reply #14 on: December 22, 2006, 04:27:01 pm »
Can that be done in GB?  ???
Logged

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #15 on: December 22, 2006, 06:03:01 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Can that be done in GB?  ???

If you mean Gameboy style graphics, feel free to change them.
Logged
Re: [Re] LttP block 16x16 grid move!
« Reply #16 on: December 22, 2006, 08:00:40 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 562
Snap to grid? 16x16?
Logged

Goodnight

Once and future Captain
Re: [Re] LttP block 16x16 grid move!
« Reply #17 on: December 23, 2006, 02:56:59 pm »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Uhm, hey Penguin. :) Are you making suggestions, or asking questions? The topic at hand was solved a while ago, and snap-to-grid wouldn't have helped.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.191 seconds with 73 queries.

anything