Side-scrolling Adventure Game help [SOLVED]

Started by Stranga, Mon 21/10/2019 02:55:15

Previous topic - Next topic

Stranga

Hello everyone,

I would like to know if there is a better way of implimenting a side-scrolling adventure game. I am currently developing one and I've noticed the system I'm using is a little jarring. The character walks left and right fine, but when inspecting a hotspot/region/object he lift/drops a pixel or two above or below the ground rather than stay on the ground (if it is making sense)

Screen: Here is how the game looks.
Spoiler

[imgzoom]https://i.imgur.com/sXCpNQu.png[/imgzoom]

Here is how I'm currently making the walking method.
[imgzoom]https://i.imgur.com/SMjupWg.png[/imgzoom]
[close]

I'm also using keyboard controls only, since I want to port my games to consoles in the near future.

Any help will be greatly appreciated, thank you all!

Khris

Are you using the Keyboard Module?
Have you found out why they move down a pixel? Are you using WalkTo points for hotspots? How do you trigger interacting with a hotspot?

eri0o

Hey Stranga, I have open sourced some stuff which may or may not be relevant to you, so I will leave them below in case anything is useful.

An open source game using same approach for 2D sidescroller: Hell's Puppy

Alternative Keyboard/Joystick control to Khris Keyboard Module : Controlz

Realistic 2D physics, has a small demo for sidescroller with keyboard control: AgsBox2D

A simple arcady platformer, not the focus of the code but may be useful: rellax module demo


Stranga

@Khris I am using a keyboard module but I think the problem lies within the room editor's WalksToPoint before the hotspot triggers. I don't necessarily need it, but it's just nice to position the player without having to add the WalksToPoint in the room's script. But to get it to work without the pixel jump up/down it has to be exactly on the y.position of the player. This becomes tedious, especially on levels with a tall room.

@eri0o Thanks for sharing some ideas. I do like the rellax module! Trying the demo now.

Cassiebsg

In script you can just use player.y instead of the the actual y.  ;) This would of course mean you need to drop the room editor's WalksToPoints.

If typing player.Walk(x, player.y, and so on) is too much. You could just write a small function, so that you could do:

Walk(70); (where 70 is the x)
or
Walk(spot); (this would be a string).

The function could then look like:
Code: ags

function Walk(int spotX) 
{
  player.Walk(spotX, player.Y, eBlock, eWalkableAreas);
}
There are those who believe that life here began out there...

Stranga

That's actually not a bad idea @Cassiebsg! I'll give that a try :-D

SMF spam blocked by CleanTalk