Added the submarine to intro. 1024x768 on PC now.
This commit is contained in:
1
actor.py
1
actor.py
@@ -50,6 +50,7 @@ class BaseActor(pygame.sprite.Sprite):
|
||||
|
||||
def set_position(self, new_pos):
|
||||
self.position = list(new_pos)
|
||||
self.rect.center = (self.position[0], self.position[1])
|
||||
|
||||
def get_velocity(self):
|
||||
return self.velocity
|
||||
|
35
intro.py
35
intro.py
@@ -1,6 +1,8 @@
|
||||
###########################################
|
||||
# Created on 1-7-2013. Miguel Angel Astor #
|
||||
###########################################
|
||||
import math
|
||||
|
||||
import pygame
|
||||
|
||||
try:
|
||||
@@ -9,7 +11,7 @@ except ImportError:
|
||||
android = None
|
||||
|
||||
from state import BaseState, VALID_STATES
|
||||
from actor import BulletActor
|
||||
import actor
|
||||
import game
|
||||
|
||||
class IntroState(BaseState):
|
||||
@@ -20,15 +22,23 @@ class IntroState(BaseState):
|
||||
self.next_transition = VALID_STATES['STAY']
|
||||
self.background_color = (139, 210, 228)
|
||||
|
||||
self.screen_vertical_half = pygame.display.Info().current_h / 2
|
||||
|
||||
image = pygame.image.load('gfx/burbuja.png')
|
||||
self.sine_movement = BulletActor(0, image, "SineMovement", False, True, False)
|
||||
self.sine_movement.set_position([-20, pygame.display.Info().current_h / 2])
|
||||
self.sine_movement = actor.BulletActor(0, image, "SineMovement", False, True, False)
|
||||
self.sine_movement.set_position([-300, pygame.display.Info().current_h / 2])
|
||||
# The next line calculates the horizontal velocity of sine_movement.
|
||||
# We want it to cover the width of the screen in 20 seconds. We divide
|
||||
# by 60 to obtain the speed in pixels per frame.
|
||||
x_velocity = (float(pygame.display.Info().current_w) / 20.0) / 60.0
|
||||
# We want it to cover the width of the screen plus the width of the submarine sprite
|
||||
# in 20 seconds. We divide by 60 to obtain the speed in pixels per frame.
|
||||
x_velocity = (float(pygame.display.Info().current_w + 600) / 20.0) / 60.0
|
||||
self.sine_movement.set_velocity([0.5, 0])
|
||||
self.sine_movement.move()
|
||||
|
||||
image2 = pygame.image.load('gfx/submarino1.png')
|
||||
self.submarine = actor.BaseActor(1, image2, "Submarine", True, True, False)
|
||||
# Instert second animation frame of the subamrine.
|
||||
|
||||
# Create the particle system.
|
||||
|
||||
if game.DEBUG:
|
||||
print "Velocity: " + str(self.sine_movement.get_velocity())
|
||||
@@ -48,16 +58,14 @@ class IntroState(BaseState):
|
||||
self.next_transition = VALID_STATES['QUIT']
|
||||
|
||||
def update(self):
|
||||
|
||||
self.sine_movement.update()
|
||||
if game.DEBUG:
|
||||
print
|
||||
print "NEXT UPDATE"
|
||||
print "Velocity: " + str(self.sine_movement.get_velocity())
|
||||
print "Position: " + str(self.sine_movement.get_position())
|
||||
print self.sine_movement.is_moving()
|
||||
sm_position = self.sine_movement.get_position()
|
||||
self.submarine.set_position([sm_position[0], self.screen_vertical_half + math.sin(0.05 * float(sm_position[0])) * 42.0])
|
||||
|
||||
if self.next_transition != VALID_STATES['QUIT']:
|
||||
sm_position = self.sine_movement.get_position()
|
||||
if sm_position[0] > pygame.display.Info().current_w + 30:
|
||||
if sm_position[0] > pygame.display.Info().current_w + 300:
|
||||
self.next_transition = VALID_STATES['MENU']
|
||||
else:
|
||||
self.next_transition = VALID_STATES['STAY']
|
||||
@@ -66,3 +74,4 @@ class IntroState(BaseState):
|
||||
def render(self, canvas):
|
||||
canvas.fill(self.background_color)
|
||||
self.sine_movement.draw(canvas)
|
||||
self.submarine.draw(canvas)
|
||||
|
2
main.py
2
main.py
@@ -29,7 +29,7 @@ def main():
|
||||
screen = pygame.display.set_mode(screen_size)
|
||||
else:
|
||||
# If not on Android, default to a 800x600 pixels screen.
|
||||
screen = pygame.display.set_mode((800, 600),
|
||||
screen = pygame.display.set_mode((1024, 768),
|
||||
pygame.FULLSCREEN | pygame.HWSURFACE)
|
||||
pygame.display.set_caption("Super HUGS Revolution 98")
|
||||
pygame.mouse.set_visible(False)
|
||||
|
Reference in New Issue
Block a user