Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Moving Through Terrain Tag 1 [RESOLVED]

EDIT: Okay, it's resolved  ;D

Hey,
I'm eventing a way to throw objects a few feet. However, I want the object able to be thrown across water, but not through other objects. Is there a way to set an object's move route to take "One Step Forward" only if the tile in front of it is passable, or has terrain tag 1?

Yeah I figured all the problems out, now it's working fine, thanks everyone who helped :)
Oh and I've taken out the code momentarily, but I might release a tutorial about how to event this once my game is finished ;)
 
Hmm... I guess that would work, although it'd require a bit more eventing (I'd have to create one for every map, like the nut) :-\ . I'm still open to other suggestions, but thanks anyway.
 
Bump. Still open to suggestions on how to do this. Maybe, is there a way to add one to the object's x or y coordinate, depending on which direction it's facing, and check THAT's terrain tag?

Something like this?
Code:
event[1].x = variable 1
event[1].y = variable 2
If event[1].direction == 2
  variable[2] +=1
Elsif event[1].direction == 4
  variable[1] -=1
Elsif event[1].direction == 6
  variable[1] +=1
Elsif event[1].direction == 8
  variable[2] -=1
end
If variable[1], variable[2] = terrain tag 1
  Move route[nut] (Ignore if can't move):
    Through on
    1 Step Forward
Else
  Move route[nut] (Ignore if can't move):
    Through off
    1 Step Forward
end

I could probably do the first part using events, but what I need to know is, how do check the terrain tag of two variable value coordinates? That's all I need to know, thanks.
 
Well I've pretty much already got it figured, all I need to know is the coding for the terrain tag with variables (see my latest post). But if you want to try and make it cleaner go ahead, thanks :)
 
First thing that comes to mind is that regardless of whether the nut moves or not, the variables will be updated as if it had - which could be a problem if there is water behind say, a tree - the player could then throw the nut through the tree, a total of (5 - distance to water) tiles. To remedy this, I suggest setting the variables to the nut's position after every possible move.

Also, what problem are you having, exactly? Is the nut not moving at all, moving when it shouldn't, or just moving... wrong?

Another thing is that if the player changes facing while the nut is in the air, so will the nut. It would be better to base all branches but the first on the nut's facing.
 
EDIT: Yes, it finally works ;D I replaced the Wait for Move's Completion with Wait: 2 frames, and although it's not the smoothest throw ever, it can go across water and stop when it hits something. The problem was the Wait for Move's Completion being incompatible with Ignore if Can't Move. Thanks for all your help, guys :D
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top