Pages: 1
Topic closed
I Just used the Thingy when touching sprite or colour move back -Number Steps, But when u Jump ON it brings me back.
How can i put this in one sprite? Because to work properly, i would need to make 2 sprites: a wall and a ground. But i don't want that.
Can please anyone tell me?
Thanks
Offline
lu9 wrote:
I Just used the Thingy when touching sprite or colour move back -Number Steps, But when u Jump ON it brings me back.
How can i put this in one sprite? Because to work properly, i would need to make 2 sprites: a wall and a ground. But i don't want that.
Can please anyone tell me?
Thanks
You could always use colour sensing - making the ground one colour, and walls another, and then sense that way.
Another commonly used method is to make four sprites, which should be just lines, two of which should be horizontal, and two should be vertical. Make sure the center of the costumes are spot-on, then forever send them to your sprite, plus or minus a few pixels - the idea being that they surround the sprite. For example, say our sprite is 50 pixels wide and the costume center is right in the middle. The left sprite should have a script like this:
When Green Flag Clicked Forever go to x: ((x position of Sprite) - 25) y: (y position of sprite) end
You can alter that code for right, down, and up, too.
Then, create a global variable for left, right, up, and down. Make the four sprites have their ghost effect set to 100, so they won't be showing (but don't use the hide block because sensing no longer works properly if that is the case). Then make it forever so that if a sprite is touching the walls/ground, set their corresponding variable to 0, otherwise it is set to 1. Then, on the character sprite, make it so that moving can't be done in a particular direction if the corresponding variable is equal to 0.
This method is a lot more accurate than the first one I described and requires a lot less work once you have the engine done. I know I described it kind of vaguely (more as a concept than anything else), so if you need any help with it, feel free to ask me.
Hope that helped!
Last edited by coolstuff (2010-05-25 16:46:44)
Offline
Instead of four extra sprites, could you use two;
1. a "horizontal" pair of lines for above/below, and
2. a "vertical" pair for left/right?
or does it have to be four?
Offline
infinitum3d wrote:
Instead of four extra sprites, could you use two;
1. a "horizontal" pair of lines for above/below, and
2. a "vertical" pair for left/right?
or does it have to be four?
I'm pretty certain there should be four - otherwise, how would it tell which side is in contact with the wall? I see what you're saying, but this was is bump-less. If you want a sprite jumping up & down, two will do.
Offline
How do you make it so that the character sprite can't move if the variable is zero?
Offline
if <(variable) = (1)>
[Insert moving script here]
end
Offline
Pokemonfan226 wrote:
if <(variable) = (1)>
[Insert moving script here]
end
Thanks for trying to help out, but this topic has been solved - I'll close it to prevent any more confusion.
Offline
Topic closed
Pages: 1