Author Topic: A clean game  (Read 40369 times)

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: A clean game
« Reply #30 on: 2009-06-26, 08:32:10 AM »
on my ranat game i was able to have the player push a boulder without pushing back at you using the script. ill post the code i use later (when i get to a computer, right now im using my phone)

now that i think of it, the code i used was something like this in VBS

Code: [Select]

' default speed is 4
With ProjectObj.GamePlayer.PlayerSprite
If .DX >  4 Then .DX =  4 'Player cannot get pushed more than 4 to the right
If .DX < -4 Then .DX = -4 'Player cannot get pushed more than 4 to the left
If .DY < -4 Then .DY = -4 'Player cannot get pushed more than 4 up, gravity remains normal effect
End With

this, way when a sprite pushes against another sprite, it doesn't shove it back. to make things better, you can set it for only certain collisions so if you are rolling something like a huge boulder, you move slower than usual

isn't there something you could do like this in the sprite rules?
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #31 on: 2009-06-28, 08:51:36 PM »
Well, sometimes the player has to get pushed back -- for example if the pushed sprite hits a wall, then the player tries to walk into it, the player must be pushed back so that it doesn't walk through the pushed sprite.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: A clean game
« Reply #32 on: 2009-06-28, 09:51:22 PM »
even so, as long as the "pushed" sprite is set to repel, it will still act as a solid. limiting how fast the sprite can go can stop the "bouncing" caused by repeling sprites. it works really well.
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #33 on: 2009-06-29, 05:41:00 AM »
There is no "repel" setting in SGDK2.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #34 on: 2009-06-30, 08:31:40 PM »
I finally got the pushing working "good enough".  I have posted an updated version of the project:
http://sgdk2.enigmadream.com/ben/CleanGame.zip

Hopefully the old version isn't still stuck in your cache.  If you get the latest version, you should see pushable packages.

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: A clean game
« Reply #35 on: 2009-06-30, 09:55:35 PM »
Is it possible to change the resistance the package provides? This would be good as a core sprite rule in SGDK2 too.  ;)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #36 on: 2009-07-01, 04:59:24 AM »
A sprite either repels/avoids other sprites or it does not.  How can this be "partial"?  What would you do with the ability to change resistance?

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: A clean game
« Reply #37 on: 2009-07-01, 05:40:03 AM »
It just seems to push the box very quickly, I was thinking perhaps if the player was slowed down when pushing into the box so they couldn't push it so fast you could make bigger boxes that are slower to push, or small particles that simply fly away when you touch them.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #38 on: 2009-07-01, 03:32:15 PM »
Is it because I still forgot (I think) to limit the frame rate?  Although I suppose having something able to limit how fast a pushable sprite could be pushed could accomplish a couple things I guess.  Maybe it's as simple as limiting the velocity of the pushed object to a slower speed (right now it has a high limit).

If you edit the Limit Velocity rule on the Package sprite to limit to a speed of 2 instead of 8, I see you can make them push much more slowly.  But for some reason that causes them to be able to go through each other sometimes.

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: A clean game
« Reply #39 on: 2009-07-01, 05:18:04 PM »
It's not because of the framerate, I limited that to 60 myself. It just seems as if the player is not hindered at all when pushing around the box. Maybe instead of limiting the velocity of the box, you limit the players velocity when in contact with the box?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #40 on: 2009-07-02, 05:08:47 AM »
It's easier to limit the velocity of the box.  It works reasonably well if you move the limit velocity rule above the "react to pushback" rule and set the maximum to 3.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #41 on: 2009-07-12, 10:08:18 AM »
I've updated the game at http://sgdk2.enigmadream.com/ben/CleanGame.zip
Now there's a world map and you can be hurt by touching enemies.
Controls:
Down arrow: Move down (world map only), climb down or crouch
Left arrow: Move left
Right arrow: Move right
Up arrow: Move up (world map only), climb up or stand up
Ctrl: Enter level or Jump
Space: Drop bomb

There's something I have to investigate, though.  Sometimes the red package lands on the plant branch, and then if I stand under it and drop a bomb, the bomb somehow lands on the red package way above me.  Something really screwy is going on there.

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: A clean game
« Reply #42 on: 2009-07-18, 04:48:55 PM »
i think i fixed the "box" problem a bit

I changed the "React to Pushback" rule to "If" and added two rules under it. one is 0=dx and 0=dy. this stops the boxes from pushing each other back by "stopping" them (it's not perfect, but it works pretty well).

edit: by "box" i mean "package"
« Last Edit: 2009-07-18, 04:56:10 PM by SmartBoy16 »
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #43 on: 2009-07-18, 08:26:44 PM »
What a coincidence, I just did something similar this morning (or was it yesterday).  I made the inertia of the boxes be 50% instead of 95%, which improved their behavior significantly.  But I also overhauled the ReactToPushBack and related functions.  I haven't uploaded the results yet, but I probably will soon, when I have something else worthwhile to show.  I also implemented a "seed" state for the sprout sprite so that a plant can start out as a seed.  Then I implemented a water droplet sprite that will cause the seed to sprout and deactivate the droplet.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: A clean game
« Reply #44 on: 2009-12-31, 11:06:40 AM »
I've added a new enemy to CleanGame.  It faces the player and jumps every N frames (you can set how long it waits between jumps).  Right now it's 120 frames (about 2 seconds).
http://sgdk2.enigmadream.com/ben/CleanGame.zip