Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Platformer example [using bump] - Gideros Forum

Platformer example [using bump]

rrraptorrrraptor Member
edited January 27 in Game & application design
Just want to share a simple platformer example :smile:
Here is a video:
And source: https://github.com/MultiPain/gideros-platformer

Code is not very well commented, because my english is not good enough :neutral:
+1 -1 (+9 / -0 ) Share on Facebook

Comments

  • piepie Member
    Cool, does it use bump? I see there is bump.lua in the file list but I am on mobile right now. Bump is native since some gideros release ago :smile: I think you can remove that file and use the plugin. also, adding bump word in this topic will make it easier to find it later :smiley:
  • rrraptorrrraptor Member
    edited January 27

    Nice example.

    Thanks.
    pie said:

    Cool, does it use bump?

    Yeah, it is.
    pie said:

    Bump is native since some gideros release ago

    Hmm...i missed that...
    pie said:

    adding bump word in this topic will make it easier to find it later

    Done o:)

    Edit: have some problems with native bump. I need custom response function for one-way platforms, and it looks like this:
    local slide, cross = bump.responses.slide, bump.responses.cross
    local oneWay = function(world, col, x, y, w, h, goalX, goalY, filter)
    	if col.normal.y < 0 and not col.overlaps then
    		col.didTouch = true
    		return slide(world, col, x, y, w, h, goalX, goalY, filter)
    	else
    		return cross(world, col, x, y, w, h, goalX, goalY, filter)
    	end
    end
     
    self.world:addResponse("oneWay", oneWay)
    But with native bump, i cant get access to cross and slide function.

    Likes: antix, pie

    +1 -1 (+2 / -0 ) Share on Facebook
  • jdbcjdbc Member
    Thanks, I was thinking about to develop a platform game and I need to create some prototype first. You save me some time.
  • antixantix Member
    edited January 27
    Nice one @rrraptor, I really like your solution to the one way platform issue :)

    Maybe @hgy29 can build this one into cBump :)

    Likes: hgy29

    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
    +1 -1 (+1 / -0 ) Share on Facebook
  • hgy29hgy29 Maintainer
    Yes, I certainly can add your custom response to native bump, One way platforms are so common with platformers that even original bump should have included it at first. i would call it platform instead of oneway though.
  • Just to say, love the way you've coded the movement. So easy. May use the good bits in my next game. :)
    My Gideros games: www.totebo.com
  • @hgy29 well, this is not my implementation) I found the solution on love2d forum. But kikito (bump dev) says:
    for moving one-way platforms, you will need a bit more (platforms will need to "push up" whatever is touching them when they are moving up)
    So the solution is a bit more complicated.
  • totebototebo Member
    edited January 28
    I downloaded the demo from Github and tried to run it with the latest Gideros 2018.1.1. Got an error:
    ./Stuff/bump.lua:43: x must be a number, but was nil(a nil)
    stack traceback:
    	./Stuff/bump.lua:43: in function 'assertType'
    	./Stuff/bump.lua:54: in function 'assertIsRect'
    	./Stuff/bump.lua:617: in function 'add'
    	Stuff/Platformer.lua:10: in function 'init'
    	[string "property.lua"]:52: in function '__new'
    	[string "property.lua"]:46: in function '__new'
    	[string "property.lua"]:59: in function 'new'
    	Scenes/GameScene.lua:68: in function 'loadLevel'
    	Scenes/GameScene.lua:15: in function 'init'
    	[string "property.lua"]:52: in function '__new'
    	[string "property.lua"]:59: in function 'new'
    	main.lua:8: in main chunk
    I tried to require "cbump" instead of the Lua Bump, and then I get this error:
    Scenes/GameScene.lua:43: attempt to index field 'responses' (a nil value)
    stack traceback:
    	Scenes/GameScene.lua:43: in function 'setupWorld'
    	Scenes/GameScene.lua:12: in function 'init'
    	[string "property.lua"]:52: in function '__new'
    	[string "property.lua"]:59: in function 'new'
    	main.lua:8: in main chunk
    Would be great to get it working out of the box, to show people new to Gideros.
    My Gideros games: www.totebo.com
  • rrraptorrrraptor Member
    edited January 28
    @totebo i fixed that already )) Order matters...
    See the commit
    https://github.com/MultiPain/gideros-platformer/commit/bf41948f59196a8f5790614cbeb4d0342cee2511
    or screenshot:


    It doesn't work with native bump, for some reason. I removed custom response function, fixed "Item ray must be added to the world before getting its rect" error, and now player just crushing...
    1.png
    720 x 108 - 11K
    1.png 11.4K
  • totebototebo Member
    edited January 28
    Ok cool, halfway there! I also got that "item needs to be added" with Bump in my own game. Maybe it's a bug in the Gideros c version of Bump?
    My Gideros games: www.totebo.com
  • @rrraptor The reason I wanted to download the demo was to see if jump height can be controlled. As in, the longer you hold jump the higher you jump.
    My Gideros games: www.totebo.com
  • totebo said:

    jMaybe it's a bug in the Gideros c version of Bump?

    Yeah, in my case world:project(...) works in lua version without adding item to the world, but cbump requiring to do so.
    totebo said:

    jump height can be controlled

    Nope, it doesnt.

    Btw, this example will not work with native verion, becouse of custom response function.

    Likes: totebo

    +1 -1 (+1 / -0 ) Share on Facebook
  • hgy29hgy29 Maintainer
    rrraptor said:


    So the solution is a bit more complicated.

    Sure, I used a custom filter instead for Arthur and additional game logic for moving platforms. But collision response would be a start anyway.
  • antixantix Member
    I didn't use any custom response for one way platforms, I just processed it in the collision filter.
    Follow me on FaceBook Check out my DevBlog, my GitHub, and try my games...
    Falling Animals | Breaky Wall | Exetor | Mini Putt Golfing
Sign In or Register to comment.