2d skateboard game
-
@waldron Sure thing! Let me know if you run into any questions.
Incidentally, I'll be working on my game tonight-- I found a bug yesterday, where I am accidentally doing an operation on an unloaded sprite in my "actors" array (crash!), but only after switching boards 3-4 times. I'm sure it's a simple bug in my logic, but it's odd that I need to switch boards multiple times for it to manifest. Weird!
-
@Spacemario cheers im reanimating my character atm but might start laying down framework for the level switches sure il be needing your help again haha thanks man
-
@waldron I fixed my weird bug a couple of hours ago! I had code something like this:
for i = 0 to len(actors) loop curSprite = actors[i].sprite removeSprite(curSprite) …. repeat
For some reason, that "curSprite" variable was referencing a sprite other than "actors[I].sprite", because the crash error was telling me, "you can't remove a sprite which has already been removed, you dolt!"
So, I replaced all references in my loop to "curSprite" with "actors[i].sprite", and the code worked.
Next step: the HUD.
-
@Spacemario glad you got it working man,
I'm trying to get y axis movement atm but character vibrating on the collision map lol -
This post is deleted! -
@Spacemario Want to be able to move up and down y axis but hitting collide map. Want it like the simpsons game style.
Ignore background still building the level. -
This post is deleted! -
just like this
-
@waldron I think I might know what the problem is! In my game, I was setting player speed to 0 when they collided with the map hit boxes. Then, when the player would overlap such a hit box, they'd be "stuck". So, I added some code to set their speed to like 10, and reverse their angle, so they'd "bounce" off the hit box-- and that gave me the desired effect.
At one point, I had the "rebound speed" too low, and they would "vibrate" on the collision box and be stuck-- does any of this apply to your game, maybe it's a similar issue?
Your game reminds me most of "Skate or Die 2"-- back in like first grade, my best friend and I used to play the heck out of it on his NES. Looking back now as an adult, it's a pretty evocative game-- very atmospheric, and the Rob Hubbard soundtrack is great!
-
@Spacemario instead of the bounce effect, I think you can use the player coords (player.x, player.y) and their last position. something like (oldPlayer.x, oldPlayer.y) and if the player collides with an axis, just set the location of the player to the old coordinates.
if collision on x axis then
player.x = oldplayer.x
endifand at the end of your instructions for drawing the sprite have:
oldplayer.x = player.x
oldplayer.y = player.ySomething along those lines i think...
-
@Spacemario that could actually work for me if i applied up and down with their own properties /gravity
il have a mess -
@lawyerlounge i thought about this route but think its above my coding experience il look into it
im only 3 weeks in to coding. -
thinking if i just plotted my player in the middle no gravity then i can freely move and just have gravity for jump and have collide at the bottom and top
-
what do you mean by "in the middle NO gravity" and then "just HAVE gravity for jump"?
Like having moving upwards on the y axis and jumping doing the same just at a different rate while jumping?
-
@lawyerlounge position my player in the middle of the screen, if i have no gravity the player will sit in that position and i can freely move it around.
to jump and have the player/sprite come back down apply gravity to that button press???? no idea mate -
@lawyerlounge its not a game breaker i can either have that mechanic or not or just add it later if needs be would be nice to get it working shouldn't be as hard as it seems
-
@waldron yeah so basically have the dpad left/right affect the x coordinate for the sprite and the dpad up/down affect the y coordinate for the sprite. And when you press "A", use a gravity variable that (like the dpad up/down) also affect the y coordinate for the sprite.
And just like the "Simpson's" style movement with a pseudo 3rd dimension, you will need collisions in certain places. if you go "deeper/up/farther away" towards a wall, you will need to base the collision by the players feet/skateboard and when you go "down/towards the bottom" base the collision from the bottom of the board or wheels.
Also, if your player is all the way up against a far wall, you should still be able to jump, and in this case the skateboard will need to resist the collision with the wall. I guess anytime your guy is jumping, you can ignore y axis collisions.. though I'm not sure sounds pretty tricky.. but I like thinking these things out loud, since they can help with future problem solving.
-
@lawyerlounge yeah i think its something to be looked into and can apply to many games
-
This post is deleted! -
iv got my character loaded as an image not a sprite and stuck with its current size,
is there a way of resizing it without cut pasting into a bigger tile size?
also can i make a multiple animation sheets for each animation...idle,move,jump ect
i can do it with the sprite version of the game i made.
would i do it in the same fashion e.gchrsheet = [ loadImage( "Selavi Games/JapaneseSetting", false ),
loadImage( "Selavi Games/JapaneseSetting", false )
]