Hi there, I've managed to Gravitate my player, but when I insert the code for boundaries the player doesn't respawn and falls straight down. Any idea how I can fix this? Thanks
I had an error with the collision where the game would crash, often taking Flash with it. This was somehow related to setting the _vy variable (which I had defined as velocityY in my version) to 0 after the collision occoured. I fixed this by setting it's value to the y-position of the character movieclip, just in case anyone else is having the same problem.
ive got a problem im doing a platformer slide with no gravity or jumping and the camera works but the character gets pulled to the left of the screen please help asap
so based off your coding I began to script on my own... It took me a while but I did it. Question though. I have a character walking animation that from 1-29 frames is him walking right, and walking 30-58 of him walking left. I've been sitting here trying to think of a function or input that would do something like. If Left arrow is held down. gotoAndPlay frame 30..because I have 58 scripted to go back to 30 and 29 to return back to frame 2, 1 is him in a standing position.
Thanks very much for these videos, they were very helpful. One problem I have is that if I am at the side of the platform with a little bit hanging off, the player can stand on it, but if I jump on it the player falls through. Is there a way around that? Thank you :)
another way to fix the continues jump is to make another boolean var. in the area where you declare your other private var's add in private var jump:Boolean; in the your main function add jump = false; In your key controls add this to case 38 if(jump) { _vy = -20; jump = false; } and in your processCollisions in your hit test point checks add this jump = true; That should work. I tried to add a check for vy == 0 but i was still able to double jump at certain points of hte jump.
O, I forgot to mention that I just duped the code and used y. I figured it might be messing with the boundary to determine respawns but it seems to reset anyways but after a longer fall. So I'm pretty sure this is not the best way to go about it.
Amazing video, thanks for this quick guide that has shown me soooooo much. BTW if anyone tried adding a camera tie to the y axis you may notice that the boundaries constantly shake. I'm not sure if this is a good way of doing it but it seems to work. I went into the processCollisions() method and changed the while collision inside the if to say _player.y -=1; instead of .1 and that stops the shaking. Just a quick fix, let me know if its not a good permanent fix. Thanks again DevNote!
for those needing a 100% reliable solution (e.g. for professional-grade projects, and projects developed for paying clients), i do want to point out that this solution will act somewhat unstably when the "player" is walking down declines (i.e. the jump will seem to be randomly and repeatedly disabled in these situations).
@benod@DevNote if you move your if(_vy == 0){ to right AFTER the case 38: and just include the _vy = -20; within it, it seems to be loads more reliable and work better with the other keys. Just saying, easier solution.
Everything works perfectly and a huge thank you! But now I have been trying to progress further with this current script to enhance some of the features. I've been trying to add x and y directions to the scroll function but am having some trouble. I thought by repeating the current lines but with .y instead of .x and stageHeight instead of width would have worked but clearly I'm not thinking about this in the right way. Any suggestions please?
@hypersnegl given that there are no error messages to work off of, i think the best first step would be to try using the original source code (found at devnote [dot] org). also, if you're testing the app straight off of the adobe flash ide, make sure the keyboard shortcuts are turned off on the swf window ("Control" -> "Disable Keyboard Shortcuts").
let me know if that doesn't work. i'm sure we can figure it out without too much trouble.
@KingWill1987 looks like you put "Event" where "KeyboardEvent" was supposed to be..? let me know if that doesn't work, and I'll try'n figure out another possible solution :)
Hello. Thanks for this tutorial. Only one issue here --
My boundaries work except for when I try to jump upon them. If I fall from one block onto the next, my collision is working but when I jump, I fall through the next block.
EDIT: Never mind that last comment. I erased the scribbles I made with the paint brush as boundaries and recreated them with boxes. That did the trick.
thank you for the feedback. it seems that you've figured it all out already, but just in case others have missed the details, i want to mention here that the problem with paint brush boundaries is that they can be too thin for a collision to be triggered. i.e. the player and the boundary images never overlap.
Nice video! this really helped me. i just have one question. is there any way to fix the infinite jumping? i know you said you would put that in the advanced tutorial, but is there an easy way to fix it?
thanks! the easiest way to disable infinite jumping is to test and flag sufficient boundary proximity per frame and enable jumping only when the boundary is farther than a predetermined distance.
for example, when you're testing for boundary collisions (as seen in the tutorial), also keep track of whether the test came back true or false, then use that result to also enable or disable the jump button for that particular frame.
this is the unoptimized solution, but the groundwork is the same.
"optimizing" this particular solution method would involve testing strategic distances from the player (i.e. not just testing for collision, but also testing for near-collision). this will prevent the jump being disabled when your player is simply walking down a steep slope.
hope that helps! sorry for the wait for that next tutorial, been really busy with the day job (aren't we all).
yeah same thing here. tried it got impatience and screwed up took another hour at home succeded in 1 go. ty mate you helped me out for my school project ;)
Firstly, I'm thankful to hear that the video was of help in something as practical as a school project.
Secondly, I'm sorry but I haven't yet gotten around to formatting and uploading the advanced tutorials. I'd list off all my "good" excuses, but I know no one cares for that.
However, it's definitely on my todo list, so don't give up on me just yet. If you subscribe, you'll get a notification whenever the new tutorials are posted (I'm not selling anything; it's just for your convenience).
at 2:45 it just keeps falling trough, no errors or anything. Everything is the same as you, please help
GamerDutch 1 week ago
HOW THE FUCK DO YOU KNOW HOW TO WRITE THAT STUFF
MLGDarksword 2 weeks ago
This has been flagged as spam show
At around 2:44 why not replace lines 75 - 95 with the following:
while(hitTest){
player.y -= 0.1;
vy = 0;
}
tammamn 1 month ago
@tammamn YouTube is such a pain in the ass to comment on.
tammamn 1 month ago
@tammamn Also, where are the advanced tutorials?
tammamn 1 month ago
Comment removed
tammamn 1 month ago
Comment removed
tammamn 1 month ago
Comment removed
tammamn 1 month ago
thank you so much i was able to do this because of YOU :)
politicaltruth42 2 months ago
OMG AMAZINGG VIDEOOO!!
damn this is complicated!
politicaltruth42 2 months ago
Hi there, I've managed to Gravitate my player, but when I insert the code for boundaries the player doesn't respawn and falls straight down. Any idea how I can fix this? Thanks
chrisyrulz893 2 months ago
how i do to make my player dont jump again and agin without hit the floor???
blackfredo 2 months ago
I had an error with the collision where the game would crash, often taking Flash with it. This was somehow related to setting the _vy variable (which I had defined as velocityY in my version) to 0 after the collision occoured. I fixed this by setting it's value to the y-position of the character movieclip, just in case anyone else is having the same problem.
WebMaster1337 4 months ago
Dear DevNote,
You are a lifsaver!
That is all....
haha, nah, cheers mate, you've helped a lot with my assignments. I'll send you a link to the game once it's finished.
TheHippoCrypt 4 months ago
Love it, please create the advance tutorial, really looking forward to it. By the way, do you accept bribes?
leejinhuey 5 months ago in playlist More videos from DevNote
Amazing tutorials. Looking forward to the advanced ones if you ever do them :)
SoImPlayer2 5 months ago
How, exactly, would one prevent the infinite jumps? I've tried checking online, but I'm new to flash and anything I try just gives me more errors.
697134002 8 months ago
@697134002
Nevermind, I figured it out.
697134002 8 months ago
@697134002 care to share?
GrimJim8000 6 months ago in playlist Making a Basic Side Scroller Flash Game
could some one post the full script for me as a comment
NightmareEdits 10 months ago
@NightmareEdits
go to his website wwwdevnoteorg put the dots and click on DocumentMain
and you wil see the full code
iphoneandnick 9 months ago
How could I check for collision with an Orb, against walls in all directions? (The idea beeing, that the character is a floating orb)
My first idea was to check not simply for player.x/.y but for .x-50/.y-50, .x+50/.y-50, .x-50/.y+50,. x+50/.y+50 (Because the Radius is 50)
However, this feels like an unclean solution and I can think of cases where this would give me unwanted results.
Is there a better solution?
Thanks in advance and a big thumbs up for your videos!
Keyfun777 11 months ago
I keep getting error #1084 in both lines 70 and 88. It's in:
if (_boundaries.hitTestPoint(_player.x _player.y, true))
Please help, i don't know what to do!
ruig 11 months ago
ive got a problem im doing a platformer slide with no gravity or jumping and the camera works but the character gets pulled to the left of the screen please help asap
ThomasChadders 1 year ago
@ThomasChadders Sorry Ignore this i write up the code wrong
ThomasChadders 1 year ago
these tutorials are excellent! are you still planning on releasing the advanced tutorials? i would be very interested in watching them
csumsky3 1 year ago
What the fuck dude, can't you explain what we are doing?
This isn't a tutorial in anyway. No explanation of what we're doing. Just you doing it.
agovu2 1 year ago
is there a way to place an object on the stage without having it scroll along with the player?
TheMrClunge 1 year ago
@TheMrClunge
just put it on the stage
it wil only scroll along if you put code below with the linkage name so just put the object on the stage and it won't scroll along
instance_name.x += (stage.stageWidth * 0.3) - player.x;
iphoneandnick 9 months ago
brilliant mate! wish my tutor at university was half as good as you!x
TheMrClunge 1 year ago
so based off your coding I began to script on my own... It took me a while but I did it. Question though. I have a character walking animation that from 1-29 frames is him walking right, and walking 30-58 of him walking left. I've been sitting here trying to think of a function or input that would do something like. If Left arrow is held down. gotoAndPlay frame 30..because I have 58 scripted to go back to 30 and 29 to return back to frame 2, 1 is him in a standing position.
gamerforlife705 1 year ago
Thanks very much for these videos, they were very helpful. One problem I have is that if I am at the side of the platform with a little bit hanging off, the player can stand on it, but if I jump on it the player falls through. Is there a way around that? Thank you :)
Survul 1 year ago
MyMadMonster 1 year ago 2
@MyMadMonster This really helped me a lot! Thanks a bunch!!
frapollidesign 1 year ago
O, I forgot to mention that I just duped the code and used y. I figured it might be messing with the boundary to determine respawns but it seems to reset anyways but after a longer fall. So I'm pretty sure this is not the best way to go about it.
_boundaries.y += (stage.stageHeight * 0.5) - _player.y;
_player.y = stage.stageHeight * 0.5;
Sleepykrooks 1 year ago
Amazing video, thanks for this quick guide that has shown me soooooo much. BTW if anyone tried adding a camera tie to the y axis you may notice that the boundaries constantly shake. I'm not sure if this is a good way of doing it but it seems to work. I went into the processCollisions() method and changed the while collision inside the if to say _player.y -=1; instead of .1 and that stops the shaking. Just a quick fix, let me know if its not a good permanent fix. Thanks again DevNote!
Sleepykrooks 1 year ago
Great tutorial hope you upload the advanced one soon. Looks like you have a great deal of good tips you can teach.
Snerren 1 year ago
For anybody looking to fix the continuous jumping problem. Look for the following:
private function keyDownHandler(e:KeyboardEvent):void
{
After this line (line 50), put the following:
if (_vy == 0)
{
Lower down in the code (line 76), it should say "default:" followed by two brackets. Put another right bracket on the line below the default line:
}
Hope this helps.
benod 1 year ago
@benod thanks for the great tip!
for those needing a 100% reliable solution (e.g. for professional-grade projects, and projects developed for paying clients), i do want to point out that this solution will act somewhat unstably when the "player" is walking down declines (i.e. the jump will seem to be randomly and repeatedly disabled in these situations).
DevNote 1 year ago
how would you make bullets?
clayf700 1 year ago
@benod @DevNote if you move your if(_vy == 0){ to right AFTER the case 38: and just include the _vy = -20; within it, it seems to be loads more reliable and work better with the other keys. Just saying, easier solution.
MooseFlakes 10 months ago
Everything works perfectly and a huge thank you! But now I have been trying to progress further with this current script to enhance some of the features. I've been trying to add x and y directions to the scroll function but am having some trouble. I thought by repeating the current lines but with .y instead of .x and stageHeight instead of width would have worked but clearly I'm not thinking about this in the right way. Any suggestions please?
nitroe 1 year ago
@hypersnegl given that there are no error messages to work off of, i think the best first step would be to try using the original source code (found at devnote [dot] org). also, if you're testing the app straight off of the adobe flash ide, make sure the keyboard shortcuts are turned off on the swf window ("Control" -> "Disable Keyboard Shortcuts").
let me know if that doesn't work. i'm sure we can figure it out without too much trouble.
DevNote 1 year ago
Hi again,
Everything works for me apart from the arrow keys. When I put in the (e.keycode) bits I get this error:
"1119: Access of possibly undefined property keyCode through a reference with static type flash.events:Event."
-Any ideas why this might be?
Many thanks dude, awesome tutorial. I've 'liked' it, (not sure where the star ranking system went lol.)
KingWill1987 1 year ago
@KingWill1987 looks like you put "Event" where "KeyboardEvent" was supposed to be..? let me know if that doesn't work, and I'll try'n figure out another possible solution :)
thanks for the "like" !
but seriously.. no more stars huh?
DevNote 1 year ago 2
@DevNote, right first time... Can't believe I've been staring at that for ages and not seen it.
Thanks! :):)
KingWill1987 1 year ago
Comment removed
Shack 1 year ago
very good tutorial learning much ^^
ninjaraeven 1 year ago
glad to hear it. thank you for the positive feedback!
DevNote 1 year ago
Hello. Thanks for this tutorial. Only one issue here --
My boundaries work except for when I try to jump upon them. If I fall from one block onto the next, my collision is working but when I jump, I fall through the next block.
NunzioMarcetti 2 years ago
EDIT: Never mind that last comment. I erased the scribbles I made with the paint brush as boundaries and recreated them with boxes. That did the trick.
Looking forward to watching your other vids.
Kind regards
NunzioMarcetti 2 years ago
thank you for the feedback. it seems that you've figured it all out already, but just in case others have missed the details, i want to mention here that the problem with paint brush boundaries is that they can be too thin for a collision to be triggered. i.e. the player and the boundary images never overlap.
DevNote 2 years ago
Great tutorial dude! how can i disable the infinite jump
heartless33 2 years ago
Great videos!! Is the and ETA on the advanced class?
Strife40k 2 years ago
Nice video! this really helped me. i just have one question. is there any way to fix the infinite jumping? i know you said you would put that in the advanced tutorial, but is there an easy way to fix it?
Spartan3572 2 years ago
thanks! the easiest way to disable infinite jumping is to test and flag sufficient boundary proximity per frame and enable jumping only when the boundary is farther than a predetermined distance.
for example, when you're testing for boundary collisions (as seen in the tutorial), also keep track of whether the test came back true or false, then use that result to also enable or disable the jump button for that particular frame.
this is the unoptimized solution, but the groundwork is the same.
DevNote 2 years ago
"optimizing" this particular solution method would involve testing strategic distances from the player (i.e. not just testing for collision, but also testing for near-collision). this will prevent the jump being disabled when your player is simply walking down a steep slope.
hope that helps! sorry for the wait for that next tutorial, been really busy with the day job (aren't we all).
DevNote 2 years ago
This has been flagged as spam show
@Spartan3572
Look for the following:
private function keyDownHandler(e:KeyboardEvent):void
{
After this line (line 50), put the following:
if (_vy == 0)
{
Lower down in the code (line 76), it should say "default:" followed by two brackets. Put another right bracket on the line below the default line:
}
Hope this helps.
benod 1 year ago
great tutorials man ! you should teach this at my uni !
only one problem, everything works perfectly untill i add the last 2 lines of code:
_boundaries.x += (stage.stageWidth * 0) - _player.x;
_player.x = stage.stageWidth = 0.5;
after i add these the final flash movie flashed white then has flashed of my coundaries appearing then dissapearing!
any theories on what is wrong ?
cheers
BrianSmith1990 2 years ago
yup! i think you left out the ".5" in that first line (see 6:25).
thanks for watching!
DevNote 2 years ago
woop ! thanks :P
BrianSmith1990 2 years ago
Superb tutorial!
janussQv 2 years ago
you rock dude
laurence485 2 years ago
haha, wow.. thank you!
DevNote 2 years ago
yeah same thing here. tried it got impatience and screwed up took another hour at home succeded in 1 go. ty mate you helped me out for my school project ;)
RikkosArientos 2 years ago
ehm you said you got an advanced tutorial can you link me plz
RikkosArientos 2 years ago
Firstly, I'm thankful to hear that the video was of help in something as practical as a school project.
Secondly, I'm sorry but I haven't yet gotten around to formatting and uploading the advanced tutorials. I'd list off all my "good" excuses, but I know no one cares for that.
However, it's definitely on my todo list, so don't give up on me just yet. If you subscribe, you'll get a notification whenever the new tutorials are posted (I'm not selling anything; it's just for your convenience).
DevNote 2 years ago
I successfully completed the side scroller by following this tutorial exactly, so thanks very much once again!
philjo1005 2 years ago
Superb just what I was looking for thank you man!!
philjo1005 2 years ago
Great! I'm glad it helped.
DevNote 2 years ago
Great tutorials!
bailbullet 2 years ago
Thanks for the positive feedback!
DevNote 2 years ago