Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - abstauber

#1541
Oh dear, thanks Steve!

Next time I'll only listen to Monsieur OUXX, when I understand what I write.  :-[

#1542
Quote
Right now bullets can fly to 0° ,45° to the left  90° left and get stuck but render at 90° to the right.

That's about what's not working ;) Those bullets should fly in all directions.
#1543
Okay, you may now start laughing. Even with all this helpI can't get it to work  :'(

Right now bullets can fly to 0° ,45° to the left  90° left and get stuck but render at 90° to the right.

I knew it wasn't just simply copy'n paste .

Anyhow here's the code.

Code: ags

//here's the bullet struct
struct cBullets {
  int x;
  int y;
  bool active;
  
  float vector_x;
  float vector_y;
  int speed; 
  int gravity;
  int sprite;

  import float Length();
  import void Normalize();
};


float cBullets::Length() {
  return Maths.Sqrt(this.vector_x * this.vector_x + this.vector_y * this.vector_y);
}

void cBullets::Normalize ()
{
   float l = this.Length ();

   if ( l == 1.0 || l == 0.0 )
      return;

   float tmp = 1.0 / l;
   this.vector_x = this.vector_x * tmp;
   this.vector_y = this.vector_y * tmp;
}

// here's shooting
// TENG.get_free_bullet works fine btw.

static function TENG::shoot_player_bullet() 
{
  int xpos;
  int ypos;
  int modifier;
  
  int nextFree;
  
  if (weapon[ego_stats.active_weapon].bullet_sprite >-1) {
    
    nextFree = TENG.get_free_bullet (true);
    
    if (nextFree > -1) {
      
      if (ego_stats.SpriteDirection == 4) {
        xpos = player.x + (TENG.get_char_width(player)/2);
        modifier = 1;
      }
      else {
        xpos = player.x - (TENG.get_char_width(player)/2);
        modifier = -1;        
      }
      ypos = player.y - (TENG.get_char_height(player)/2);
      
      player_bullet[nextFree].x = xpos;
      player_bullet[nextFree].y = ypos;
      player_bullet[nextFree].speed = weapon[ego_stats.active_weapon].speed * modifier ;
      
      player_bullet[nextFree].sprite = weapon[ego_stats.active_weapon].bullet_sprite;
      player_bullet[nextFree].active = true;
      
      if (weapon[ego_stats.active_weapon].type == eWT_Freeway) {
        player_bullet[nextFree].vector_x = IntToFloat(mouse.x - player.x);
        player_bullet[nextFree].vector_y = IntToFloat(mouse.y - player.y);
        player_bullet[nextFree].Normalize();
        
      }

    }
  }
}


// And here's the drawing, called by rep_exec
static function TENG::draw_bullets() 
{
 
  DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  
  int counter = 0;
  
  // draw player_bullets
  while (counter < MAX_BULLETS) {
    if (player_bullet[counter].active) {
      player_bullet[counter].x += FloatToInt(player_bullet[counter].vector_x) * weapon[ego_stats.active_weapon].speed;
      player_bullet[counter].y += FloatToInt(player_bullet[counter].vector_y) * weapon[ego_stats.active_weapon].speed;
 
      surface.DrawImage(player_bullet[counter].x, player_bullet[counter].y, player_bullet[counter].sprite);
    }
    counter ++;
  }
  
  surface.Release();
  
}



"Argh" says

n00bstauber


@Monsieur OUXX
As soon as this works I'll store the vector as an integer ;)
#1544
haha.. okay I think I really have a lot of choices now :D

Thanks a bunch, guys!
#1545
I hope a lot of you give it a try and then submit bugfixes :D


@Dualy
Someone else also voted for tits.
If you want to create e.g. "Humping Jackson", simply replace the close combat weapon with a penis :P

@DrWhite
I think so too. Mouse aiming doesn't automatically also mean mouse shooting ;)

Btw. I'm finally done with the player's movement.
#1546
Of course it's not ;)

Let me put it this way: you pick up a free aim gun -> you gain mouse aiming, otherwise not. Please trust me, it's better than it sounds :)
#1547
haha.. that's what is happening all the time over here.

Like RickJ said: Fixing one thing and breaking two :)

I've managed to steal the code properly, so technically it worked quite good... but it's still awful. Ledge grabbing is way more fun and a bit more "dramatic" instead of just slipping down a wall.
#1548
To be honest, I've only finished mouse aiming and then switched over to ledge grabbing. But thanks for the hint.

In other news: there won't be wall jumps. I've recently "imported" them from MariVania and unfortunately they totally oppose ledge grabbing. Okay, walljumps increase the pace, but on the other hand reduce the authenticity a lot.


#1549

One could also post a code sample :P


@Wyz: Yay :D
#1550
QuoteI thought you were planning on releasing the source code once it's done.

Yeah, that's planned, but I have no plans on writing a (tutorial / documentation) yet. Also the file format relies on ProMotion has a map editor.
#1551
Hehe, that totally reminds me at the early demo scene :D

Thanks for the help!
#1552
At the moment I'm thinking of a "real-time" ManBoy with arcade elements. Would that be cool? :)
#1553
Yes - I simply used GUIs as Layers. 2 Bullet layers, and one enemy layer. The GUIs are full screen and you're right - all that's moving are floating buttons :)

Well, this GUI button concept in AeroNuts worked great before I realised that pixel perfection is not possible with GUI buttons. So I had to convert the player's plane to a character and that resulted in a nasty z-level problem since GUI appear in front of characters. It ended in converting the carrier into a room object, but the turrets are still GUI buttons.
At that stage I decided it's better not to release the source anymore ;)

But if you like, I can upload the source somewhere (be warned, it's MAGS code).
#1554
Who would I be without your open source attitude...

Not the copycat I am now ;D
#1555
Quote from: GarageGothic on Tue 27/04/2010 21:13:33
most of what you need could be handled with simple integer maths even for angled shots

*cough*

I know how to move the bullets in a 45° angle, so 8 way shooting is easy. But for those other angles, is there any smart way to avoid calculating triangles and such?

For 45° angles I simply give the bullet the same vertical speed as horizontal speed. I know I should work with inclination, but I'm afraid I overslept that in school too :)
#1556
@Ryan & Calin:
I'll definitely add support for WASD. Maybe at a later stage, I might add a user customized keys but I don't see a real benefit for this whole day of work - yes it's not complicated but takes some time to write.

@Wyz:
I'm already keeping it abstract, because I'm not too sure how the final game will look like. It works like that:

Characters:
- player: has abilities wall jump, grabbing, 8 way shot, free mouse aim, sliding and so on
You just need to set a bool flag to turn it on or off.

- people: Can be hostile or friendly. Hostile people have classes like eny_moron (which is pretty much a goomba) or eny_trooper who is at least aware of gaps and patrols waypoints


items:
Like objects in ags, just with another name. Those can move, hide in boxes and modify player stats.

hotspots:
same as in AGS, just as a tile

Environment:
- tiles with attributes like solid, deadly etc.
- movable platforms
- stairs
- waypoints for enemies and platforms

Thats how far I'm at the moment. There's still missing shootery ;) I'm also thinking of another layer with regions, but I hardly ever use them in AGS, so hotspots may do the job as well.

There - now I feel like a showoff :P
#1557
Alright, I have scripted mouse aiming. Just aiming, no shooting yet :P

I must say, it feels very different - almost like another genre. Also I've some trouble controlling the main character with the left hand, but apart from that it's kind of cool  :=

I'll see if I can finish a small demo in the next weeks, where you can check for yourself.
#1558
The Rumpus Room / Re: Happy Birthday Thread!
Wed 28/04/2010 14:06:01
Happy Bday Poc301 :)
#1559
Ah, now I see. That bullet array is already being iterated back to front. :) But it's also possible, that those bullets don't line up in order since the 30 button limit is pretty tight.

As for those walls: It's a tile based map and each tile has a flag whether it's solid or not. My plan is to check the space in front of the bullet:

if it's a solid tile,  remove the bullet
if it's an enemy, do a collision check, if collision add damage and  remove the bullet
if it's the screen border...remove the bullet.
#1560
err... yes ;D
(and keep in mind that a lot of mac and linux users have now tears in their eyes :P )

Quote
Other optimizations include checking bullets closest to the enemy first, so you don't waste CPU cycles on checking collisions for an enemy that was already destroyed.

I'm already doing the fast box collision check - but how to manage this one? And since the bullets need to be aware of solid walls, I'll have to check each bullet anyway, right?
SMF spam blocked by CleanTalk