A few issues while working on a platformer

egyptcapriegyptcapri Member Posts: 17
edited March 2012 in Working with GS (Mac)
I have a hero and an enemy on stage, i want to trigger both the enemy animation of him walking towards the hero as well as him spawning his projectiles at the hero. The enemy presently spawns and throws his daggers at the hero but he does it from the start of the stage not when the hero gets within a certain distance. I would also love to have him move towards the hero rather than stand in the corner waiting to be killed. a ;ast issue i have is when my hero jumps instead of a regular parabolic jump he glides like a ninja if i press left or right while he is in the air i would love to fix the code that allows him to return to earth like a normal character would. Thanks in advance

Comments

  • calvin9403calvin9403 Member Posts: 3,186
    I don't understand your question, can you please describe it more clearly?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Here is a video in distance between actors


  • egyptcapriegyptcapri Member Posts: 17
    edited March 2012
    Thanks a bunch that helped with my enemy having a basic AI.

    now regarding checking for a spawned actor, i throw ninja stars and would like to limit them to only one on screen at anytime to allow a fighting chance to the enemy. how do i do that?

    Also im working at my enemy recognizing when the hero is on the left different from the right and to face him at all times.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Add a game.starCount attribute. In your ninja star actor, change attribute game.starCount to game.starCount+1. For your rule where you destroy the actor (or it moves off screen), add change attribute game.starCount to game.starCount-1 above the destroy behavior. For your rule where you spawn the ninja star, have a condition that says if attribute game.starCount=0 spawn the ninja star.
  • egyptcapriegyptcapri Member Posts: 17
    edited March 2012
    ok 3 more issues left to figure out then my game is done.

    1. the jump issue as i still cant jump properly, when running character barely leaves the ground and when standing he jumps up but then i glide if i press left or right: it wont let me copy my code lol

    2. the team would love the ability to stomp the enemy like in mario however the colliders are huge and are not stomp friendly, how can i get that to work?

    3. again like mario i would like the characters to flicker when they are dying then disappear. the disappear i know how to do using destroy its the flicker that I need to understand.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    2. Do you mean that the collidable areas are much bigger than the visible images? If so, you need to edit your images to crop any extra space around them. Keep in mind that the collision shape in GameSalad can only be a rectangle or circle.

    3. Flickering can be done with interpolate self.color.alpha to 0 (more of a fade) or change attribute self.color.alpha to 0 (and back to 1) with a timer to change it from 1 to 0 and 0 to 1 (creates a flashing actor).
  • egyptcapriegyptcapri Member Posts: 17
    2. Do you mean that the collidable areas are much bigger than the visible images? If so, you need to edit your images to crop any extra space around them. Keep in mind that the collision shape in GameSalad can only be a rectangle or circle.

    3. Flickering can be done with interpolate self.color.alpha to 0 (more of a fade) or change attribute self.color.alpha to 0 (and back to 1) with a timer to change it from 1 to 0 and 0 to 1 (creates a flashing actor).
    ok will work on the cropping to allow for decent colliders.
    will also look into the flickering as you suggest.

    Any ideas on the jump?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @egyptcapri I haven't mastered jumping yet. There are others much more qualified to answer. You can take a look at the Platformer Template (open GameSalad and click New and you'll see it in the top row of templates).
  • egyptcapriegyptcapri Member Posts: 17
    It is what i copied my jumping coded from just wont work the way i want it to.
  • deadlightsdeadlights Member, PRO Posts: 235
    It is what i copied my jumping coded from just wont work the way i want it to.
    Same issue here - I coped the actor from the platformer template, but when I jump he just continues to fly up and off the screen, never returning to earth. It's like there's no gravity. Not sure why it works in the template and not our games.
  • deadlightsdeadlights Member, PRO Posts: 235
    Try this template - I haven't tried yet, but it looks promising.
    http://forums.gamesalad.com/discussion/38132/gs-tool-box-a-free-mega-template-ready-now/p1
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2012
    @deadlights Did you set the scene gravity as well (in the template, it's Y=1500)? I noticed you found this thread: http://forums.gamesalad.com/discussion/41317/help-with-jumping#Item_0. Should be helpful since tshirtbooth is on the case.
  • deadlightsdeadlights Member, PRO Posts: 235
    @tatiang Thanks for your reply. I set the scene gravity, but now the whole screen (actor, background, platforms, etc) drops down :P
    I think you are pointing me in the right direction and I will try to get this working. Thanks again for your help!
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited March 2012
    To create gravity for only a particular actor you put in an accelerate behavior and set it to down direction and put in a speed and set the actor to collide with a invisible ground actor. Then you put a higher speed In your jump accelerate to overcome the down accelerate. I also usually set a time limit for the up accelerate like .3 sec and then trigger an addition down speed to force the actor back to the ground. I may do a video about this as I am building a runner right now.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    In addition, set the movable checkbox to false and the fixed rotation checkbox to true on your ground actor(s). Same for any background actors, etc.
  • deadlightsdeadlights Member, PRO Posts: 235
    Thank you both :)
Sign In or Register to comment.