Fuhzbahl



0

Followers

0

Following

0

Games

Games


No Games.


Shoutbox

gubba
hey there Fuz, sorry fuhz,
you asked How would I make it so that a character will bounce off game borders if they are moving left and right
6 months, 1 week ago.
I reckon you wouuld get the x position of your character and if its greater or smaller than your screen , you reverse the speed.
So if your screen is 640 by 384 you want it to reverse when its position gets outside of theses numbers
x = 0 - 640 and y = 0 - 384.
You'd pay attention to the size of your character and to the Origin Point (in actor, appearance)
if your character is 32 by 32 and the origin point is at the centre (which seems to be the default)
then you would want to turn your actor around when it gets to 16 pixels from the edge

so ( this is not the code, just the way of looking at it , you will need to find the right blocks ,.)
if
character x position is less than or equal to 16 or greater than or equal to 624
negate x speed
if
character y position is less than or equal to 16 or greater than or equal to 368
negate y speed
( negate is a code block which takes a number and reverses its sign . plus becomes minus , minus becomes plus .)
do you know what // im going to see if i can do it //

ill keep you posted

0 4 years, 1 week ago

Sign In to Comment


Recent Activity


No Recent Activity.


Forum Profile

Stencyler

Rank

0

Posts




0 Followers


Fuhzbahl has no followers


Following Nobody


Fuhzbahl follows nobody