Some fun.

Previous topic - Next topic

erico

Thanks Darmakwolf, :good:
Will check it out.

I´d hope the spanish mates on the board could help me out remembering the MSX game.
It was single screen, had destructible scenery. Damn memory, I sure would like you to check a video on that, it really could bring good inspiration at last.

Darmakwolf

I really need to make a way to "zoom in" on where the action is. Think of Smash Bros - if two characters walk to opposite ends of the map, the camera zooms out. If anyone can help that'd be great and can help move this project forward! Source attached.

On the very top is camera_module = 0, set it to 1 to enable it. In my function section you will find game_camera:

I had it so that in single-player tests I could zoom in on one player. It got really tricky when I tried to make it so it'd detect player positions and adjust the camera accordingly. If you want to take a stab at it, here's what you need to know:

Characters are elements of an array. if you want the program to do something if there are two players, you'd do:

if numplayers = 2
<do something>
endif

The "camera" is simply a grabsprite (#9001.) I am clipping part of the screen and stretching it over the screen. the result is a "zoomed in" area. Let me know if there is a better way or if you can get it working. Currently the project is only set up for xbox 360 controllers. In the near future I am adding a module that detects playstation controllers and maps them correctly. As it is right now, they'll *work,* but the face buttons are in the wrong positions. 360 controllers work fine. The game itself is not playable via keyboard/mouse. I appreciate any input! :)


:good:

[attachment deleted by admin]

Slydog

#17
I never looked at your code, but how do you do your sprite drawing?
If you don't use STRETCHSPRITE or POLYVECTORs, scaling is going to be very difficult.
Personally, I'd use polyvectors, mainly for the speed benefits.

You are going to want a global scene 'scale#' variable (or 'zoom#'), with say an initial value of 1.0.
Then I would have a 2d point (or just cur_map_x,cur_map_y) of what map location the center of the screen should center around.
(If you're 25% through a 1000 unit wide level, your x would be 250 - the 250 is the center of the screen, not the left edge)

Then when drawing your level, start at the map x,y position. (which will map to the center of the screen).
You can pre-calculate how far left, right, up, and down in your map you need to display, based on your current scale/zoom level.
Then draw each tile from the center based on the current scale. 

You could calculate each tile's top-left x,y, and width,height like this:
Code (glbasic) Select
tile_offset_from_center_x = cur_map_x - tile_map_x
tile_offset_from_center_y = cur_map_y - tile_map_y
x = tile_offset_from_center_x * scale
y = tile_offset_from_center_y * scale
w = tile_width * scale
h = tile_height * scale


I've never done this exactly, but shouldn't be too difficult.
You have to remove all hard-code coordinates from your map / sprite drawing code.
To keep things isolated, your map drawing code should be generic enough to apply to any of your future games.

With this concept, you can zoom in and out freely and smoothly to any location.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Darmakwolf

Hey Sly. The thing is, my map drawing code draws the map once when the round starts. The map is just essentially a tile-based "picture" designed with the level editor. Collision is array-tile based. I'm sure with grabsprite/stretchsprite it's possible to make the right zoom code, but it got kind of difficult when it came to getting the right "point" to zoom in on...

Slydog

Ah, ok, I never looked at your code to understand it.

I'm not sure what you mean by 'got kind of difficult when it came to getting the right "point" to zoom in on'.
Wouldn't the point be where the player is (or the average of the player's and opponent's position)?
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

erico

Quote from: Slydog on 2012-Jun-06
... (or the average of the player's and opponent's position)?

Is what I first thought too.
Other then this point, you way have to check each one, or the furthest one from this point to make sure no one gets cropped outside zoom area.

Darmakwolf

Erico - great suggestion. I'll try taking an average of player positions and adjusting the camera accordingly.

erico

Art of fighting on the neo geo can be inspiring on the ´zoom´ front.
Star Control too, the meele parts. :good:

erico

Some rygar, a bit of nes rip+some colors, nothing fancy, but there always must be a Legendary Warrior!

[attachment deleted by admin]

Darmakwolf

Thanks, Erico! My game is coming along well. I will be sure Rygar has a front row seat!

erico

#25
Nice!

Now I remember the msx game I wanted to tell you for inspiration.
It is called warroid.



It had some destructable tiles and other then shooting(auto target) you could do a meele kick when close to the opponent(check 6:00 on video to get an idea).
After the other robot died, you could still kick its body around just for fun, and this made the whole game special. :P

Edit: moby dosen´t have much on it, so better post a video.
GFX there is upscalled and smoothed out (yuck!), but you get the idea...the opening music made a lot of people cry in full emotion!

Edit2: there was no destructable tiles... my mind played a trick on me.

Darmakwolf

Ha! Looks like a fun game. This is going to be a *little* like that kind of thing, but each character has 4 distinct abilities matching the four face buttons on the controller, so there's some more planning involved in the fighting. I plan on CERTAIN tiles being destructible depending on the character. Someone with explosives may be capable of removing tiles altogether. Perhaps the most annoying character to fight would be Dig Dug?? :P